Algorithm pseudo code and flowchart

 

Some of the commonly used tools in programming are:

  • Algorithm
  • pseudo code
  • Flowchart

 Algorithm

An algorithm is the finite set of step-by-step set of statements that solve a particular problem. Once the problem is clearly stated, it is broken down into a number of steps, which are written sequentially, such a sequential procedure to solve a problem is called an algorithm. It is written in simple human readable English language. Developing an algorithm requires a clear understanding of the problem. After preparing the algorithm, one must recheck it so as to ascertain the accuracy of the various steps involved. The number of steps in an algorithm should be reduced to a minimum so as to increase the speed of the program.

An algorithm should have the following properties.

  1. It should have an input.
  2. The steps mentioned in an algorithm can be executable by the computer.
  3. Each and every instruction should be in a simple language.
  4. The number of steps should be finite.
  5.  It should not depend on a particular computer language or computer. 
  6. The algorithm should give an output after executing the finite numbers of steps.

Example 1: Design an algorithm to go to the cinema and watch a movie.

Step 1: START.

Step 2: Go to the cinema hall.

Step 3: Is the ticket counter open? If it is not open, go to step 5 else go to step 3.

Step 4: Get into the cinema hall.

Step 5: Watch the movie.

Step 6: END.


Example 2: Find the sum of the two numbers.

Step 1: START.

Step 2: Read the two numbers A and B.

Step 3: Add the number A and B and store in D. or D=A+B₁

Step 4: Display D or print D.

Step 5: STOP.


Flow chart

flow chart is a diagrammatic (pictorial) representation that illustrates the sequence of operations to be performed. After designing an algorithm, the next stage is to design a flowchart to check the flow of logic running through it. It used different predefined graphical symbols to show the data flow within a program or a system. Designers use a flowchart as a program planning tool for visually organizing a sequence of steps necessary to solve a problem.

Advantages of Flowchart

  1. It is easier for a programmer to explain the logic of a program through the flowchart.
  2. It helps in the effective analysis of the program.
  3.  Easy to detect, locate, and remove bugs in a program.
  4. Efficient means of communication.
  5. With the help of a flowchart, coding becomes effective and faster.
  6. Serve as documentation.

Disadvantages of Flowchart

  1. Very time-consuming and laborious job.
  2. Flowcharts are difficult to maintain.
  3. Occupies space while documentation.
  4. Translation of the flowchart to a computer program is difficult.

Type of Flowchart


System Flowchart

System flowchart plays a vital role in system analysis. It illustrates the elements graphically and characteristics of a system and expresses its structure and relationship in terms of flowchart symbols. A system flowchart is a diagram that shows a broad overview of the data flow and sequence of operations in a system.

Program Flowchat

A program flowchart is a pictorial representation of the steps involved in the procedure of a program. It also shows the logical sequence in which the steps are performed. It is a detailed diagram showing how individual processing steps will be performed within the computer to convert input data into the output.

Pseudo Code

It is a tool used to formulate the processing steps of a program. A pseudo code uses English phrases and mathematical statements to describe the processing steps of a program or module. The programming process is a complicated one. One must first understand the program specifications. Then need to organize one’s thoughts and create the program. Pseudo-code is used to explain the logic or concept of the program. It is called pseudo code (false statement) as it usually doesn’t match with the statement of any programming language.





Author Spotlight

Santosh Chapagain
Gmail: chapagainsantoshcs@gmail.com
Phone no: +977-9863512955

Post a Comment

0 Comments