Sorting Things Out

Wednesday August 13thAlgorithms, Series, Software Development, Sorting Category

It’s time to recap a topic that is, or should be, close to the heart of every developer. A topic that is often overlooked or glossed over, rarely fully understood and not often discussed. Yet this topic is hugely important.

That topic is Sorting.

SortingOn the surface it appears to be so simple. Just arrange some stuff in a certain order. What could be easier?

Unfortunately the implementations of various methods of sorting can be anything but easy. Determining which algorithm to choose can be difficult enough given that some lend themselves to sorting certain data types better than others do.

As a result, I’ve decided to start writing a series on the different well-known (and perhaps not-so-well-known) sorting algorithms. For each algorithm, my goal will be to:

  1. Paint a very clear picture of how it functions. I aim to do this via pictures and discussion. If I get time, I will aim to provide an animated visualiser of the algorithm (though at the moment this might be a tough ask given time constraints).
  2. Explain the order of complexity/Big-O notation so that it’s clear just how expensive it is to use, along with details of best and worst cases.
  3. Give examples of data sets where the algorithm fits well, and examples of where it doesn’t.
  4. Explain if and how the given algorithm can be used in a multhithreaded environment.
  5. Demonstrate errors that are found frequently in various implementations (if there are any), and show how to resolve/avoid them.

By the end of the series, I hope that you (and I) will have a really solid understanding of the Sorting world.

To start off with, I’ll be covering the age-old Bubble Sort. I’m choosing this because it’s very simple, and is an easy target for me to get going.

As always, comments and feedback will be greatly appreciated. I’m hoping that I’ll learn more from this exercise than you guys will.

1 Trackbacks/Pingbacks

  1. Pingback: Arjan`s World » LINKBLOG for August 13, 2008 on August 13, 2008

4 Comments

  1. Robert Greyling
    August 13, 2008

    Bring it on! Don’t just tease us now you hear! :-)

  2. OJ
    August 14, 2008

    Patience my friend, patience!

    I’m 90% of the way through the first in the series.

  3. secretGeek
    August 14, 2008

    hurry up with it then OJ. I’ve been hitting refresh every five minutes waiting for this one.

  4. OJ
    August 15, 2008

    @secretGeek: Smart arse :)

Leave a comment

Size

Colors