| ▲ | zeta0134 a day ago | |||||||||||||
I used bubblesort on purpose in a game project. Specifically, to sort sprites in an NES game back to front, lazily, spending as few CPU cycles as possible. Bubblesort on the very small list (a dozen objects max), and early exit after the first swap. It eventually completes, and that was just fine. It's tiny, incredibly simple, and somewhat resilient to the list changing from frame to frame as objects spawn and despawn. Each partial sort makes some progress no matter what. A few other algorithms would have fit the bill just as well, but bubblesort is perfectly adequate, so that's what will likely ship. More complex algorithms end up losing out due to greater initial overhead or larger ROM size. | ||||||||||||||
| ▲ | jeltz 20 hours ago | parent | next [-] | |||||||||||||
Why use it over insertion sort which is faster and easier to implement? | ||||||||||||||
| ||||||||||||||
| ▲ | cubefox 21 hours ago | parent | prev [-] | |||||||||||||
A time traveler. | ||||||||||||||
| ||||||||||||||