All About Bubblesort

This is a companion discussion topic for the original entry at http://www.kirupa.com/sorts/bubblesort.htm

The silliest final exam question I had before college was in CS 251 in 2008. (I have no idea why my name is on that page for class notes, I can’t remember everything from back then.) There was a hilarious question where you had to have memorized the Prim-Jarnik algorithm before the exam, and I certainly hadn’t.

a greedy algorithm that finds a minimum spanning tree for a connected weighted undirected graph. This means it finds a subset of the edges that forms a tree that includes every vertex, where the total weight of all the edges in the tree is minimized

Since that point, I’ve cared very little for the specifics of certain named algorithms. I once understood the intricacies of bubble sort and quicksort, but they’re really not important to understand in the long term, beyond being able to recognize when what you’re trying to solve is probably a solved problem, especially a canonical one which has made its way into textbooks and tutorials. So it’s always good to have lots of ways to look these things up, but usually not important to memorize them. Unfortunately, you might be asked to recall random crap on exams, so keep that in mind…

Totally agree. I’m thinking of doing a small book on sorting algorithms since that’s what all the students have to learn at some point, so that’s why I’m spending some time on them.

In real life, like you mention, you never need to know this. Just google a search algorithm if you need one that goes beyond whatever built-in sorting mechanism your language already provides.

:stuck_out_tongue:

You’re good at breaking down topics in a way that non-engineers understand, and I think sorting algorithms would be a great book. Do it!

Before every job interview I always spend like a week implementing sort algorithms and hash tables and stuff in different languages as a refresher. Always helps with those whiteboard tests.

1 Like

Anogar!!! Hope you are doing well :stuck_out_tongue:

Glad you liked the tutorial!

1 Like

When posting about my latest Bubble Sort revisions, this post came recommended. Funny that it took almost 9 years from this post for me actually get the book published and out the door :snail: