65 points by codewiz 5 months ago flag hide 20 comments
illu... 5 months ago next
The author forgot to mention--bubble sort is also used in teaching recursive functions. Recursive bubble sort exists and is...
recognize 5 months ago next
I see where you're coming from, but recursive bubble isn't practical. Recursion depth would cause a stack overflow
kittyfresh 5 months ago prev next
Great article! I always thought Bubble Sort was useless after learning all the other fancy algorithms.
coderpro 5 months ago next
I like implementing Bubble Sort in coding interviews because it shows that you know the concepts behind sorting algorithms.
lifewithtech 5 months ago prev next
I like how the author includes code snippets. It makes it easier for readers to understand the optimization.
chessmaster 5 months ago prev next
What are the real use-cases of this algorithm? I see it as a theor... sorry, I meant educational.
knightcode 5 months ago next
When working with small arrays, Bubble Sort can sometimes outperform the more complex algorithms.
arningt 5 months ago prev next
Some people use Bubble Sort in embedded devices or microcontrollers where memory constraints can be a limitation.
quantmod 5 months ago prev next
Would this be scalable for large datasets? I thought Bubble Sort had worse performance than the rest.
masterbits 5 months ago next
The article mentions that the author implemented an optimization called 'Optimized Bubble Sort.' This has improved performance and might work for some datasets.
n00bc0d3r 5 months ago prev next
As a beginner, this was helpful. I'll include Bubble Sort as a part of my toolbox now.
silicongray 5 months ago prev next
Does anyone know why Bubble Sort is called 'Bubble Sort'?
progmad 5 months ago next
The bubbles – at each pass, the largest element 'bubbles' to the right (top), just like a bubble rising in a glass of soda.
algorithmgeek 5 months ago prev next
I like that the author provides benchmarks and performance analysis. Great job!
ne0c0der 5 months ago prev next
Thanks for sharing this! I appreciate the effort to present the topic in a beginner-friendly way.
syntaxfan 5 months ago prev next
What language is the code in? I see a function definition with no name.
masterbits 5 months ago next
It's pseudo code, so the author can present a generic implementation that applies to any language or technology stack.
hni... 5 months ago prev next
I wonder if insertion sort could also be used in this context? It does have an average case of O(n) and only requires
theal... 5 months ago next
Yes, insertion sort is best when working with pre-sorted arrays, but bubble sort will always perform at least one pass
p... 5 months ago prev next
In the spirit of this post, I have implemented Bubble Sort in Bubblegum (esoteric programming language). Thanks for the article and I look forward to reading more of your content!