The Vindication of Bubble Sort

As long, long-time readers know, I have a strong aversion toward bubble sort. Until recently, I would have loudly argued that there are no valid reasons to even teach someone bubble sort. The argument went something like this: There is nothing good about bubble sort. It’s not intuitive or easy to understand, it’s not fast, it’s not memory efficient, it’s not conservative in terms of writes or reads. There’s nothing speaking for bubble sort. I lament that we use bubble sort to teach algorithms, because it imprints all sorts of bad habits in students and some of them actually later go on and do these stupid things in the real world. Every single case in which you may think bubble sort is a good idea, insertion sort is a better idea. In other words, it’s not even a…

Read more on Lobste.rs