Bogo Sort vs Bubble Sort
Same 110 values, same shuffle, same speed. Bubble Sort finishes first and turns gold.
The numbers
- Bogo operations
- never finishes
- Bubble operations
- 8,678
- Bogo average
- n·n!
- Bubble average
- n²
- Bogo worst
- ∞
- Bubble worst
- n²
Bogo Sort
Bogo Sort shuffles the list at random and checks if it's sorted. Then it shuffles again. More on Bogo Sort.
Bubble Sort
Bubble Sort walks through the list swapping neighbours that are out of order, until a pass makes no swaps. More on Bubble Sort.
FAQ
Which is faster, Bogo Sort or Bubble Sort?
Bubble Sort. Bogo Sort shuffles at random and, for a list this long, never finishes.
Which one is stable?
Bubble Sort is stable; Bogo Sort is not.
How is the race fair?
Both algorithms start from the same shuffle and run the same number of operations per frame. Every comparison, swap and write counts as one operation, so the one that needs fewer operations finishes first.