News for hackers. Stuff that matters.
Re:“It is never a compiler error” by nothrabannosir on Tuesday November 14, 2017 @05:33PM (#15699842)
For nearly sorted data, bubble sort is quite good. Simple implementation and near linear performance. Has my seal of approval.
Re:“It is never a compiler error” by ufo on Tuesday November 14, 2017 @05:44PM (#15699939)
Insertion sort is almost always better isn't it?
Re:“It is never a compiler error” by taneq on Tuesday November 14, 2017 @06:43PM (#15700343)
Bubble sort is also good for keeping a list close-enough-to-sorted with only small incremental costs. It was an old graphics engine trick to run just a few passes of bubblesort over your sorted triangles array before rendering each frame. Occasionally you'd get artifacts but generally it worked well enough and was fast.