All about the Bubble Sorting Algorithm

All about the Bubble Sorting Algorithm

Micro-optimizations #3


1 min read

Bubble Sort


The Bubble Sort is - of cause - an sorting algorithm. It's a simple one of it's kind, as you'll later see.

If you in the wild, wild west of CompSci sees an alorithm called Sinking Sort, it'll look a lot like the Bubble Sort, and really, it is the same thing. These are sometimes refered to as one or the other.

A Bubble Sort is not nearly as perfomant as some of its successors - and is mainly used as an educational algorithm nowadays.


As I mentioned, Bubble Sort is definitely not one of the fastest sorting algorithms out there, meaning its O-notion is O(n^2). which is never too good. Meaning it's slow.


Why would you use the Bubble Sort then? Well, it's super easy to implement, which is also why people use it, and learn from it as - again - it's a great starting point.


Below is an embed from, this is interactive. Try it yourself and check if you can speed up the Bubble Sort!

{ Best, Mads Bram Cordes }