3 ms·
Bubble sort is popular because it's provably optimal... under extremely restrictive circumstances: https://stackoverflow.com/a/3274203 https://stackoverflow.com
by ynik 7y ago
Bubble sort is popular because it's provably optimal... under extremely restrictive circumstances: https://stackoverflow.com/a/3274203 https://stackoverflow.com/a/3274203
Those circumstances stopped being semi-relevant when even the cheapest computers started using (floppy) disk drives instead of tape drives, but somehow bubble sort is still being taught.
- NeoBasilisk 7y agoIt's probably because the implementation of the algorithm is the simplest, because you don't need to modify the existing data structure. You don't need to merge or create new arrays. You just repeatedly loop and swap two elements when needed. Super easy by all metrics.
- vengefulduck 7y agoYou don’t need to modify the data structure for most quadratic sorts though. Or even for quick sort.
- BubRoss 7y agoMost people get the partition algorithm wrong on their first try if they write it themselves.