"If You're Getting Bored, Let This Be A Lesson About O(n2) Sorts"

After posting about how fast things change in the computer hardware field, I came across this 25 year-old film by the University of Toronto that compares and contrasts various sorting algorithms. I was fascinated with these algorithms when I was in college and after watching this 30 minute film, I can assure you that I’m still intrigued by the subject.

The most interesting thing I realized from watching it is that sorting algorithms haven’t changed at all since this movie was made. That is, quicksort is still the most widely used sorting algorithm (followed closely, I’m sure, by bubble sort — not because of it’s efficiency, but because it’s the way we humans sort physical things (i.e. playing cards), so naive programmers often “reinvent” this way of sorting in code, only to find out later just how slow O(n2) algorithms actually are). Most modern computer languages provide built in sorting routines these days, and those routines use quicksort.

So, even though our computers are getting faster and smaller at an exponential rate, the theory behind efficiently programming them was largely finished decades ago. Of course, this is all on the verge of disruption as we start dealing with multi-core parallel processing and quantum computers where algorithms like quicksort that we’ve grown to rely on no longer work very well and start to look like poor, old bubble sort.

That’s when I know it’ll be time to retire.

4 responses to “"If You're Getting Bored, Let This Be A Lesson About O(n2) Sorts"”

  1. Quicksort and Mergesort do lend themselves well to parallel processing since they both are “divide and conquer”-style algorithms.

    As for quantum computing, I mentally file that stuff under “voodoo” and have no idea as to how classical algorithms will fare on such platforms.

  2. Excellent point about the divide and conquer algorithms being well suited for parallel processing. Of course, this will still require us old-timers to take inter-processor communication into account when actually writing our code, unless we get those automatic parallelizing compilers we’ve been promised for the last decade or so.

  3. The sound effects on the video are awesome–makes me feel like I’m in the future of the past.

  4. “…makes me feel like I’m in the future of the past.”

    Isn’t that… the present?

Leave a comment