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."
Sorting is not a boring problem, and what are you 5 years old being amused by zoop-zap noises?
Anybody who did their first programming steps with QuickBasic will remember that it came with a demo that did just this. Anyway, the videos are still fun to watch.
Does anyone remember "Sorting Out Sorting" (1980)? Best sorting video ever made. This is the same thing, it's good, but it was done thirty years ago. Also, "Pointy Does Pointers" (not an adult film, I swear).
Interesting.
Feel like I'm complaining about a poll with a missing option, but, honestly ....:(
gus
.. if only.
The Shear Sort is one of my favorite sorts out there. Although you will need an orchestra to play it.
If something is so important that you feel the need to post it on the internet... It probably isn't that important.
That is awesome.
"It's because they're stupid, that's why. That's why everybody does everything." -Homer Simpson
Ted Bundy would disagree
It doesn't even matter if it matches the sorting. All sorting algorithms will benefit from the playing of Popcorn.
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.
There was a dismissive comment recently modded down about being "easily amused" by the bleeps and bloops, well that may be so, but it sure adds flavor to the process.
I can imagine how various sorting operations work in my head but I never thought about what they might sound like, and that makes them just a little more interesting. :-)
crazy dynamite monkey
One thing this seems to show me (at least the video does)
the rate of completion - how much is sorted by each point in the process
the algorithms seem to all do that a bit differently; some have most of the work completed in the beginning, some in the end.
Most seem to take one piece of data and plunk it right in order; the merge sort seems to be the only one with intermediate groupings.
and there's one final pass to make sure the data's in order.
I notice different sorting processes are appropriate for different RL sorting situations.
I listen to both RIAA and non-RIAA stuff if I like the music, tangential business/politics nonwithstanding.
A lot of them sound like something you'd hear at the beginning/end of some song from the 60s or 70s.
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.
I'm not a big fan of these sounds, but I like the idea.
Merge Sort - traffic sound
Bubble Sort - blowing bubble sound from bubble bobble
Insert Sort - coin slot
Select sort - crain game sounds
Gnome Sort - 7 dwarfs singing Hi-Ho, Hi-Ho
At least that way you can associate sounds with different algorithm types and remember what they are.
Any one see this as some sound files for the BBC Dr. Who Series.
My CS lecturer prepared a number of these for an intro CS course. I took the class back in '06-'07, but IIRC the videos were taken from Mac OS X. That said, it is pretty neat.
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.
because i just got off to that geek pr0n
My favorite sort. Randomly arrange items until they are in order. Would the appropriate music be some type of carnival melody?
The bubble sort used here is kinda bogus. It iterates over the whole set on every pass, which it doesn't need to. It only needs to go over dataset-(pass-1) items. I have a feeling this will change the "sound" of the bubble sort in this example.
The Selection Sort's soundtrack was quite fun!
It feels like your head is going to explode at the end, and the final pass is the sound of brain matter splattering across the pages of your algorithms textbook.
I found http://www.sorting-algorithms.com/ to be useful for looking at how sorting works, too.
http://wolfbell.com/projects/index.html - Porttwiddle is an add-on module to a one-disk linux router project that will play sounds of different frequency depending on the port number. You'll never miss a portscan again! ;-)
I sorta like it.
Gamingmuseum.com: Give your 3D accelerator a rest.
They should bring back the Slashdot poll to discuss which of these sorting algorithms sounds best. (IMO, Insertion sort, bubble sort, and Heapsort sound coolest.)
The sounds aren't quite the same, but Quick Basic for MS DOS had a program in the Examples folder that does almost exactly this. Generates random data and shows various sorting techniques on it visually, playing a different tone for each comparison made. Not as much data (since it had to graph it in 320x200), much slower in a 286, and sound was done by internal speaker, but same idea at least.
ASCII stupid question, get a stupid ANSI
A tutor once filled text mode video memory (DOS days, no memory protection) with the solid block character in random colours, then sorted said video memory with bubble sort, heap sort, shell sort and quick sort. In other words, the coloured blocks sorted themselves on screen. Remarkably effective demonstration of the relative speeds and of how the algorithms work.
Meh, sorting should be covered in about 2 hours in any programming course. I spent an entire quarter on sorting back in college and I still to this day cannot see the point of repeating the same exercise over and over again, just with a different sorting algo. But perhaps my professor was just retarded (that was the general consensus between the students anyway).
WTB New slashdot CSS/JavaScript programmer. The current one really blows.
Sorting may be boring, but it is an awesome way to really dive in to a language(at least c++).
I read Knuth for fun... I don't get this notion of algorithms being "boring"...
Bow-ties are cool.
What do you mean it's fairly dry? Sorts are awesome!
Respect the sorting algorithms!
As an undergrad I worked in the university library to earn a bit of spending money, and one of my tasks was sorting books to put them back on the shelves. My colleagues used selection sort. I didn't.
I did a first pass through the books. Two piles, typically A-L, M-Z. Then a second pass, A-D, E-L, M-R, S-Z. And so on, until the piles were small enough I could go through them and put them on the shelf in order.
How many people do you know who actually use quicksort to sort real objects?
...laura
What about random sort, where you swap 2 random values and test to see if it is sorted. I assume it would sound like static, probably white noise (as opposed to pink noise).
If you are about to mod me down, keep in mind that this post was most likely sarcastic.
Actual code and performance analysis shouldn't be boring or "dry" to someone who aspires to be a computer scientist or specifically a programmer, especially not the first time they learn about it...
I was listening to some dance/trance music. I though I had a problem with my speakers playing the video because I didn't notice any new sounds :o
from 09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0
to 45 2F 6E 40 3C DF 10 71 4E 41 DF AA 25 7D 31 3F
Still possibly the easiest (C++) sort for arbitrary types:
// populate some_vector
// do something with item
#include <vector>
#include <algorithm>
#include <functional>
class my_type
{ public:
int item_data;
};
bool isless_my_vector (const my_type ref1, const my_type ref2)
{ return ref1.item_data < ref2.item_data ? true : false; };
int main ()
{
std::vector some_vector;
my_type item;
item.item_data = 5;
some_vector.push_back (item);
item.item_data = 10;
some_vector.push_back (item);
std::sort (some_vector.begin(), some_vector.end(), std::ptr_fun (isless_my_vector));
for (std::vector::iterator iter = some_vector.begin(); iter != some_vector.end(); iter++)
{
item = *iter;
}
return 0;
}
It's more efficient if the vectors holds pointers instead of data.
Sorting may be boring to implement repeatedly (tedium by definition), but I found learning the various standard sorting algorithms to be pretty interesting, and a great practical introduction to pointers.
Programming is first and foremost about problem solving, regardless of whether you're creating a game or a spreadsheet, and sorting is a common problem. If you find learning (and discovering) how to solve problems effectively and efficiently to be boring, then you're probably pursuing the wrong line of work.
https://www.eff.org/https-everywhere
the authors should listen to Franz Schubert's Symphony Number 9.
Nice vids but where are the llamas?
For all you young whippersnappers: these sounds resemble the noises emanating from a series of C=64 games by Jeff 'Yak' Minter, one of the better known software developers from the 80's.
--frank[at]unternet.org
random sort:
seed random
create vector of pointers to data, with rand variable
std::sort() by rand member
For me, he's a legend. Technology is full of wonder and because of education and corruption, people don't really see or experience this kind of thing nearly enough. This is way better than anything else I've seen. A college mate of mine did a project in Ireland on visualizing the main algorithms but this is erm heeps ..ahem better.
The key to human education is in our senses - all of them!! even feelin, emotions can be used to understand technical concepts. You may not know it but this is at the fringe of technology. We poor, forsaken humans aren't allowed access to it for the most part, but in an ideal world, visual, and acoustic aids can be used in this manner to learn algorithms of some complexity.
The open source developers behind Apache, PHP, Mozilla etc. are vitally important to us but this guy and people like him are the future of education if there is to be one.
And note, how elegantly this ties in with cellular automata / game of life etc. They're really one and the same to those of us who are not automaton's and can see that.
Wolfram is on the right track.
AWESOME
makes me think of an old lady hoovering a floor on speed!
Seriously? That many people thought this was neat? The sounds are totally annoying. That's why it's video and not audio, the video is sort-of neat as we can see what's happening. The audio, with or without the video only detracts from the ambient noise anywhere in the world.