There are at least three different ways of representing solution to any problem. There is a significant disconnect between requirement gathering and programming syntax. Directly converting this textual descriptive information into code is complex and error-prone.

The technique, also known officially as pseudo code, aids in bridging the gap between description and programming syntax. It aids the programmer in the conversion of problems written in a loose language into programming language syntax. This allows both reducing the risks of error and reducing the amount of time necessary for coding.

An algorithm is a simple type of program with no explicit syntactic requirements. Using his language, one may construct an algorithm.

Different Ways of Representing Solution

Different ways to represent problem solutions
Different ways to represent problem solutions

Natural language 

This is the easiest way of writing an algorithm. It contains English like statements. This representation completely omits technical aspects of programming language syntax.

Pseudocode

This representation is very close to the generalized syntax of a programming language. It provides a clear depth of nested statements and repetition of statements. Pseudo code representation is a bridge between natural language representation and programming language. It is more precise.

Flowchart

It is a graphical representation of the algorithm. It uses a standard set of symbols to represent the flow of operation.

Example

Give natural language, pseudocode and flowchart representation of an algorithm to add elements of the array of size n.

All three different ways of representing solution are discussed here:

Natural language representation

  • Step 1 :   Read number n
  • Step 2 :   Scan n elements in array A
  • Step 3 :   Add all numbers of array A and store in the variable sum
  • Step 4 :   Display sum

Pseudocode representation

Algorithm SumArrayElements(A)
// Description: Algorithm adds digits of the input array
// Input: Array A of size n
// Output: Summation of all elements of array A

sum ← 0 
for i ← 1 to n do
    sum ← sum + A[i]
end

write “sum”

Flowchart representation

While solving the problem, the tendency to start writing code without designing an algorithm should be resisted. Time spent on design and analysis of algorithm helps in quick implementation.

Flowchart
Flowchart

Additional Reading: Learn about Flowchart