News for hackers. Stuff that matters.
Re:When would you ever want bubblesort? (2023) by jaw0 on Wednesday December 10, 2025 @11:42PM (#46227750)
at a previous workplace, every new hire would discover the handwritten bubblesort in our codebase, freak out, and submit a pull request to fix it.

and every new hire got taken to the whiteboard to learn about sort algorithm performance: bubblesort is O(n) in the best case.

and in our codebase, the data being sorted fit that best case (the data was already sorted or almost sorted).

Re:When would you ever want bubblesort? (2023) by avmich on Thursday December 11, 2025 @01:59AM (#46228473)
Not only in best case. Haven't seen this elsewhere, and know only few people who know that, so, a kind of a puzzle: what are the conditions when bubblesort is always O(n)?