4 ms·
Bubblesort isn't useless! (binpacking)
- snprbob86 18y agoBubble sort is also useful when there is temporal coherence or when exact sorting is not necessary. For example, in graphics programming you typically need to sort transparent objects back-to-front. If things are out of order, there may be anywhere from no to huge artifacts. If things are mostly sorted and your objects are reasonably small, you can expect closer to no artifacts. You could run a few passes of bubble sort each frame, save the effort of doing a full sort, and then even if you get major artifacts they won't last more than a 1/30th of a second or so.