Nassi-Shneiderman diagram, flowchart and program flow chart
In short: Structure charts (Nassi-Shneiderman) and program flow charts present algorithms graphically; they are common in training and IHK exams.
In more detail: Before writing code it helps to draw the flow of an algorithm. Two classic notations are the Nassi-Shneiderman diagram (boxes nested in each other) and the program flow chart with symbols and arrows.
In Depth
The basic building blocks
Every algorithm consists of three structures:
- Sequence: statements one after another.
- Selection (branch):
if condition then … else …. - Repetition (loop): with test at the head or foot (
while,until,for). A structure chart knows only these three boxes, so jumps (goto) are not possible and the flow stays clear.
Nassi-Shneiderman diagram
+-------------------------------+
| read number |
+-------------------------------+
| number > 0 ? |
| yes | no |
| print "pos." | print "not |
| | positive" |
+-------------------------------+
Repetitions appear as an indented box, for example “while i < 10: …”. Advantage: unambiguous, each structure has one entry and one exit.
Program flow chart
Symbols according to DIN 66001: oval for start/end, rectangle for processing, diamond for decision (yes/no branches), parallelogram for input/output, arrows for the flow. The flow chart is more flexible but can become confusing (“spaghetti”) if many jumps arise.
Practice and exam
Typical tasks: maximum of numbers, sum 1 to n, prime test, sorting, factorial. Approach: clarify inputs and outputs, describe the flow in words, then draw and play through with test values (desk check with a table of variable values). Check edge cases such as 0, empty input, negative numbers. Pseudocode helps too.
See also: Modelling (UML, EPC, BPMN), Pseudocode, Loops