On the Subject of Sorting
What is the point of implementing a sorting algorithm if you are going to do it manually anyway?
- The module has a screen and 5 buttons. Refer to the algorithm provided by said screen.
- Positions refer to order from left to right, ignoring vertical offset. For example, 1st position classifies as bottom left.
- It solves when all positions go in ascending value, and strikes if a swap defies the algorithm.
| Bubble Sort | |
|---|---|
| Swap them if... | |
| 1st position’s label is greater than 2nd position’s label. | |
| 2nd position’s label is greater than 3rd position’s label. | |
| 3rd position’s label is greater than 4th position’s label. | |
| 4th position’s label is greater than 5th position’s label. | |
| Repeat Bubble Sort. | |
| Slow Sort |
|---|
| Swap them if... |
| 1st position’s label is greater than 2nd position’s label. |
| 2nd position’s label is greater than 3rd position’s label. |
| 1st position’s label is greater than 2nd position’s label. |
| 4th position’s label is greater than 5th position’s label. |
| 3rd position’s label is greater than 5th position’s label. |
| 1st position’s label is greater than 2nd position’s label. |
| 3rd position’s label is greater than 4th position’s label. |
| 2nd position’s label is greater than 4th position’s label. |
| Repeat Slow Sort. |