Stooge Sort vs Bubble Sort
Same 110 values, same shuffle, same speed. Bubble Sort finishes first and turns gold: 8,678 operations to 268,350.
The numbers
- Stooge operations
- 268,350
- Bubble operations
- 8,678
- Stooge average
- n^2.71
- Bubble average
- n²
- Stooge worst
- n^2.71
- Bubble worst
- n²
Stooge Sort
Stooge Sort recursively sorts the first two thirds, the last two thirds, then the first two thirds again. More on Stooge 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, Stooge Sort or Bubble Sort?
On this shuffle of 110 values, Bubble Sort needed 8,678 operations and Stooge Sort needed 268,350, about 30.9× as many. On average Stooge Sort is n^2.71 and Bubble Sort is n².
Which one is stable?
Bubble Sort is stable; Stooge 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.