Beruflich Dokumente
Kultur Dokumente
Software Engineering
Sequence
Structure Testing
Selection – if statement
Structure Testing
Loop
Flow graph for bubble sort
1
sorted = false; // 1
while (!sorted) { // 2 2
sorted = true;
for (int i = 0; i < SIZE-1; i++) { // 3 3
if (a[i] > a[i+1]) { // 4
swap(a[i], a[i+1]); // 5 4
sorted = false;
5
}
} //6 6
} //7
//8 7
8
2N Paths
Dijkstra’s Game
Conclusion
The color of the last ball is dependent on the number of white balls in the jar,
i.e. it is the parity of the white ball
If even number of white balls, end up with the black ball
If odd number of white balls, end up with the white ball.