-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Nico Mexis edited this page Feb 19, 2024
·
5 revisions
This is just a silly, simple project showing, how one could visualize Sorting algorithms using Processing. Inspired by thousands of YouTube videos showing essentially the same thing... And I wanted to do something like that myself...
| Key | Action |
|---|---|
| + | Increase actions per second by factor 2 |
| - | Decrease actions per second by factor 2 |
| T | Turn sound off/on (Caution: Could be very loud, depending on your system settings) |
| Key | Algorithm | Worst case run time | Average case run time | Best case run time | in place (in situ) | stable |
|---|---|---|---|---|---|---|
| I | Insertion Sort | θ(n2) | θ(n2) | θ(n) | ✓ | ✓ |
| M | Merge Sort | θ(n log(n)) | θ(n log(n)) | θ(n log(n)) | ✓ | |
| H | Heap Sort | θ(n log(n)) | θ(n log(n)) | θ(n log(n)) | ✓ | |
| Q | Quick Sort | θ(n2) | θ(n log(n)) | θ(n log(n)) | (✓) | |
| N | Bubble Sort | θ(n2) | θ(n) | θ(n) | ✓ | ✓ |
| S | Slow Sort | θ(nlog(n)/2) | θ(nlog(n)/2) | θ(nlog n/(2+e)) | ||
| C | Comb Sort | θ(n2) | θ(n log(n)) | θ(n log(n)) | ✓ | |
| V | Cocktail/Shaker Sort | θ(n2) | θ(n) | θ(n) | ✓ | ✓ |
| D | Stooge Sort | θ(n2,71) | θ(n2,71) | θ(n2,71) | ||
| F | Smooth Sort | θ(n log(n)) | θ(n log(n)) | θ(n) | ✓ | |
| B | Bogo Sort | ∞ | θ(n n!) | θ(n) | ✓ |
Miracle Sort could also be called "Quantum Bogo Sort", because it basically just waits, that a miracle happens. Like e.g. a Geomagnetic Sun storm hitting the internals of the computer and swapping bits, so that the array is all of a sudden sorted.
| Algorithm | Worst case run time | Average case run time | Best case run time | in place (in situ) | stable |
|---|---|---|---|---|---|
| Bucket Sort | θ(n^2) | θ(n) | - | ✓ | |
| Counting Sort | θ(n+r) | θ(n+r) | - | ✓ | |
| Radix Sort | θ(d (n+k)) | θ(d (n+k)) | - | ✓ |
What those symbols mean:
| Symbol | Meaning |
|---|---|
| r | Maximum of the value range |
| d | Number of the largest number's digits |
| k | k-adic numbers |