Pseudocode (pronounced 'soo-doh-code') is a sequence of English-like statements that represent an algorithm. The term 'code' refers to a computer program. Therefore, representing an algorithm in pseudocode means that the algorithm is written using a language similar to a programming language.
There are no standard rules for writing pseudocode. Individual freedom is allowed. The widely accepted convention is to use indentation to clarify the statement blocks. Pseudocode can be constructed as an outline of a program so that it is easy to convert the algorithm into program codes at a later stage.
Stepwise refinement may also be applied to pseudocode as in the two examples below:
The intial algorithm is as follows:
1) Get data
2) Calculate wage
3) output total wage
1.1) Get number of hours worked 1.2) Get hourly rate 2)
Calculate wage
3) Output total wage |
1.1) Get number of hours worked 1.2) Get hourly rate 2)
Calculate wage
2.2.1) Calculate number of overtime hours
3) Output total wage |
III) Program flowchats
The importance
of program flowchat is declining because this tool is not suitable for
complex algorithms
|
|
|
|
|
|
|
|
|
|
|
|