News for hackers. Stuff that matters.
Re:Programmers can’t write algorithms without help by mark-r on Monday November 04, 2019 @12:02PM (#21443643)
Bubble sort is good for two reasons. First, it's so easy that anybody should be able to remember how to do it. Second, it's slow and everybody should know that and be able to point it out.

It's actually usable for small enough n. I once coded it when I expected n to be 4 or less, and I'm sure the person who replaced it cursed my name when that expectation turned out to be false.

Re:Programmers can’t write algorithms without help by kadoban on Monday November 04, 2019 @12:09PM (#21443731)
For a simple sort you can use for small N, I'd suggest insertion sort. Its constants are better, it performs well on almost-sorted input, and I think it's even easier to implement, personally.
Re:Programmers can’t write algorithms without help by mark-r on Monday November 04, 2019 @12:11PM (#21443763)
Yes, I've heard that suggestion many times since then. I wasn't well versed on the different sorts at the time.