Pseudocode is our main tool for documenting algorithms.
Flowcharts are equivalent to pseudocode and are also common, but are not part of the VCE courses. Flowcharts are easier for non-programmers to read as they are inherently two-dimensional, so branches (conditionals, if statements) and loops (iterations) are actually represented by a branching or looping of the flowchart.
Pseudocode flattens out the flowchart into a sequence of lines of something like "real" code. The hardest part of the translation from flowchart to pseudocode is the choice loop structure to use, as flowcharts are more flexible in this area.
Assigning values to variables is done with an arrow, which serves to show the flow of data, e.g., count ← 5
Control Structures have clear beginning and ending keywords and their code blocks should be clearly indented.
Algorithms are built out of a sequence of statements to control input and output, assign variables to results, control flow. There are four types of flow in algorithms:
See the Pseudocode to Python dictionary and Python Snippets pages to compare the above pseudocode to Python.
Adding two numbers
This is a method to check an algorithms by running them by hand using test data (how to choose a suitable set of test data is discussed in the next section). If the pseudocode does not produce the expected output for the test then the trace will help you locate the error.
The idea is you track all of the variables and output in a table, working line-by-line through the code and updating the variables when they are assigned a new value. It helps to use a finger or a 2nd pen to point to the line currently being evaluated.
Here is an animated trace table example from 101computing.net.
Note that their psuedocode uses a slightly different syntax from the VCE "standards".number ← 3
OUTPUT number
FOR count FROM 1 TO 3 STEP 1
number ← number + 5
OUTPUT number
NEXT count
OUTPUT "?"