Slashdot Mirror


Sorting Algorithms — Boring Until You Add Sound

An anonymous reader writes "Anyone who's ever taken a programming course or tried to learn how to code out of a book will have come across sorting algorithms. Bubble, heap, merge — there's a long list of methods for sorting data. The subject matter is fairly dry. Thankfully, someone has found a way to not only make sorting more interesting, but easier to remember and understand, too."

8 of 118 comments (clear)

  1. No Quicksort? by gus+goose · · Score: 4, Insightful

    Feel like I'm complaining about a poll with a missing option, but, honestly ....:(

    gus

    --
    .. if only.
  2. Try it with people by twoshortplanks · · Score: 5, Funny
    It's always more fun to do this with real people (sort by height, for example). The London Perl Mongers tried this as a drinking game: You get enough people down the pub (or, in one this case, outside a bar in portugal during conference season) and apply booze. Then bubble sort them as a group (lots of shouting Stay! Switch!.) Add drinking penalties when people screw up the algorithm. You get the idea.

    There's a video on the internet somewhere. Free pint to the first person to find it.

    --
    -- Sorry, I can't think of anything funny to say here.
  3. The sound of bubble sort by Anonymous Coward · · Score: 5, Funny

    That's strange. When I listen to the sound of bubble sort all I hear is one of my college professors threatening to hunt me down and kill me in my sleep if I ever use it.

  4. Re:QuickBasic did this by commodore64_love · · Score: 4, Informative

    Ditto MS BASIC 7(?) on the old 1985 Amiga - included demos with sound.

    Plus TV shows, especially scifi ones, do this all the time. The computers don't have to make noise but the audio engineer added the sound to keep the show from being dull.

    --
    "I disapprove of what you say, but I will defend to the death your right to say it." - historian Evelyn Beatrice Hall
  5. Diagnostics by PPH · · Score: 4, Interesting

    One interesting application of such audible/visual representations could be for diagnostic reasons.There are numerous cases where experienced observers can spot patterns or anomalies in patterns that machine algorithms have trouble with.

    One example I was involved in years ago at Boeing was a tool for diagnosing a large switch matrix used in a piece of automated test equipment. Each output could be tied to a high, low or open signal, driven from a controller over an HPIB bus. Failure modes included not only an output stuck high, low or open, but address bus problems where some lines would cause passive failures or activate more than one pin. After watching a poor engineer go through a suspect matrix panel for over a day, entering a command on the bus, finding the pin on a patch panel, sticking a voltmeter on it, over and over a few thousand times, we came up with a solution. Bi-colored LEDs wired to a patch panel and a program to exercise the matrix with a series of address patterns. An observer could spot a single bad switch or a hung address bus line in a few seconds just by looking for an anomaly in a couple of checkerboard and other patterns.

    --
    Have gnu, will travel.
  6. Re:As a decided non-expert... by pjt33 · · Score: 4, Informative

    The heap sort actually has intermediate structure. If you watch carefully you can see that it has two phases, the first much shorter than the second. However, the structure isn't as visibly obvious as for merge sort.

    If it had showed quicksort (I can't understand why it didn't) then you'd have seen some intermediate structure there too.

    I also noticed that the selection sort wasn't as good as it could be. It's more efficient to select the largest and the smallest unsorted values on each pass - you halve the number of passes, and on each pass you do 50% more work, so overall it's a 25% improvement.

  7. Re:Sorting is a waste of time by mea37 · · Score: 5, Insightful

    If you think all that time examining sorting algorithms was intended to teach you about sorting, then you indeed missed the point. Programming courses spend a lot of time on sorting because it is a common task that can be easily understood, but for which there are a lot of different algorithms with very different performance characteristics. The point is to teach algorithm analysis skills.

    Judging from the quality of code I encounter regularly, though, you're far from alone in failing to pick up that lesson.