HN Theater @HNTheaterMonth

The best talks and videos of Hacker News.

Hacker News Comments on
What different sorting algorithms sound like

andrut · Youtube · 242 HN points · 2 HN comments
HN Theater has aggregated all Hacker News stories and comments that mention andrut's video "What different sorting algorithms sound like".
Youtube Summary
This particular audibilization is just one of many ways to generate sound from running sorting algorithms. Here on every comparison of two numbers (elements) I play (mix) sin waves with frequencies modulated by values of these numbers. There are quite a few parameters that may drastically change resulting sound - I just chose parameteres that imo felt best.

After making this video I found that someone already tried to audibilize sorting algorithms:
http://www.pillowsopher.com/blog/?p=116
- he mentions other older attempt: http://www.math.ucla.edu/~rcompton/musical_sorting_algorithms/musical_sorting_algorithms.html
And someone in comments metions similar attempt on different aproches to Towers of Hanoi problem in 1982; there was also attempt on trying to hear minimax search in chess engine in 2009: http://www.krazydad.com/blog/2009/05/musical-chess/ .

This is my first attempt on making algorithms audible. For some time I was wondering what would it sound like if cpu made different noises for different instructions. It all started while trying to play raw files (texts, images, programs...), then I heard few "raw" tracks on Alva Noto CD... and then I did one strange audio-visual simulation http://vimeo.com/6711459 and then I tried to play out voltage potentials simulated by spiking neural network implementation - it worked out really cool so I wanted to try something with algorithms - thats how I got here. I know this work is not novel but I feel it isn't explored enough. I see future uses of similar techniques in monitoring and debuging, teaching and gaining insight of more complicated algorithms, science (as an extension to ploting tools)... and arts.

If you heard of something similar please drop me a line.
HN Theater Rankings

Hacker News Stories and Comments

All the comments and stories posted to Hacker News that reference this video.
Aug 28, 2016 · 1 points, 0 comments · submitted by bbayer
May 14, 2013 · 1 points, 0 comments · submitted by thetabyte
May 14, 2013 · 4 points, 0 comments · submitted by alexvr
Sep 26, 2012 · 1 points, 0 comments · submitted by BIackSwan
Here's what different sorting algorithms sound like - http://www.youtube.com/watch?v=t8g-iYGHpEA

Bubble sort takes the most time. :)

InclinedPlane
Only because bogosort wasn't tried.
Dec 12, 2010 · 4 points, 1 comments · submitted by batasrki
Isamu
And people say bubble sort isn't any good. I suppose they haven't HEARD it yet?
Aug 19, 2010 · 231 points, 39 comments · submitted by pavs
momokatte
This makes me want to sort something. The loose change strewn all over my desk. The contents of my fridge. The words on this page. Anything.
petdog
Anything. The The The This all change contents desk. fridge. loose makes me my my of on over page. something. sort strewn this to want words
jacquesm
all Anything. change contents desk. fridge. loose makes me my my of on over page. something. sort strewn The The The This this to want words
hyyypr
Awesome link. It reminds me of a website showing a matrix with visualizations of several sorting algorithms: http://www.sorting-algorithms.com/ (which was posted somewhere here iirc).
ramki
where is quicksort?
jacquesm
Too fast to hear.

But nice to look at:

http://www.youtube.com/watch?v=vxENKlcs2Tw&feature=relat...

sesqu
Bullshit on the too fast. Mergesort never needs more comparisons than quicksort, and mergesort was featured.
jacquesm
Errm. Yes. I know that. It was a joke...
sesqu
I've noticed that we don't share the same sense of humour.

Generally speaking, I've seen too many people assert that quicksort is blazingly fast to believe all of them were joking. It doesn't particularly help that the major sorting algorithms are severely fragmented, because people optimize variously for stability, time, space, comparisons, swaps, cache locality, parallelizability, best case, worst case, average case, amortized average case, arrays, lists, integers, objects...

jacquesm
quicksort has very bad performance on the wrong data.

But on the kind of data that the test showed it would perform more or less on par with merge sort. To suggest that quick sort would be that much faster than merge sort that you couldn't hear it when there are obviously quite a few steps is to me more than enough reason to assume a joke rather than a serious answer.

Anyway, humour is a hard thing to get across online, I should have added a ;) at a minimum apologies for that, also HN seems to frown on humor (even though every now and then there are some really good jokes here http://news.ycombinator.com/item?id=1597571 ) this one was reasonably lame but the subject wasn't all that serious to begin with.

Sorting is enough of an issue that Knuth devoted the better part of a very thick book to it and to this day there are plenty of people that think that 'one size fits all'.

The more you know about your data the faster you can sort it.

jemfinch
Merge sort may use an optimal number of comparisons, but that doesn't stop it from being slower than quicksort in most cases in real life.
tfmorris
Interesting, but not new. Mark Brown did this two decades ago at DEC SRC (and probably others before him). http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-76A.html
hubb
i know the choice of sounds was arbitrary, but it nonetheless reminded me of the seal calls of 'encounters at the end of the world': http://www.youtube.com/watch?v=SORza1fqQGk
snprbob86
That was super cool! I really enjoyed how my brain started matching the sound and the bar heights in such a way that by the end I said "of course that one sounds like that".
ysorter78
See another experiment: http://www.youtube.com/watch?v=ol5ml9e2THw

It sonifies the following algorithms (from http://www.algolist.net/Algorithms/ ) - Bubble sort - Selection sort - Insertion sort - Quicksort

You can also see their sonograms.

meatmanek
What, no quick sort? And no heap sort?
Batsu
There was a link to the heapsort at the end: http://www.youtube.com/watch?v=iXAjiDQbPSw
moultano
That is by far the coolest sounding of the bunch.
Synaesthesia
I think Mathematica can be used to make "audiolizations" really easily. They include one of the Riemman Zeta function as a demo. It sounds really cool (sorry I can't find a link, I'll try upload it)
keyle
That was really cool. Is the speed indicative of the speed of the sort?
frio
Given that the width of the elements being sorted changes (therefore there are more/less elements in different visualisations), I'd say no.
simonista
I'm not sure, but the visual part of the videos looks a lot like visualizations I've seen in algorithms classes where the speed does represent the speed of the sort. So I'd guess that it does here as well.

These are really great. As a musical person it engrained these concepts that much deeper for me. My wife, who is not much of a computer science person like the merge sort the best.

mr_twj
I would say it's likely. There are all sorts (pun intended) of optimizations you can do for each algorithm, but at the textbook level, I could say they seemed typical as far as speed expectancy goes. My rough estimates for the times were (in seconds): insert: ~10, bubble: ~27, selection: ~18, merge: ~17, and gnome: ~19. I have only written inserts, bubbles, and selections; with bubble being slowest and insert being the fastest, my limited experience agrees with the video. Note: the merge algorithm appeared to have sorted a different data set.
jassadat
Here is a live version of the sounds of various sorting algorithms. Done using HTML 5 audio - http://bit.ly/sort-sound
muyyatin
It would be interesting to listen to graph algorithms.
scotth
What do you imagine would determine frequency?
muyyatin
For example in depth first search, the depth.
dhs
I like that. And in breadth first search, one could use a filter on a saw wave to have the breadth of the frequency spectrum manipulated by the search.
ralph
Why does the bubble sort continue to the end of the array on every pass, when it could stop one earlier each time?
mhansen
There's a lot of effort been put in to this, I like it.

I love that you can hear the bubbling in bubble sort :D

marktucker
I noticed that too! Good stuff.
Technophilis
Merge sort's sound is actually recursive.
Luc
At times this sounds a lot like an old Williams shoot'em-up arcade game, like Defender for example.
vijaydev
Cool job! Gnome Sort - now that's new to me!
willvarfar
bubble sort sounds like someone chanting "DEVELOPERS! DEVELOPERS! DEVELOPERS!" !!!! :D
pavs
http://www.youtube.com/watch?v=KMU0tzLwhbE
transmit101
Disclaimer: sorting algorithms can sound like just about anything, depending which parameters you map to which sounds.

This is just a simple example of data sonification, albeit with some nice visualisation too, and a subject matter which appeals to the computer scientists in the room.

Tichy
I thought the values to be sorted would be the amplitude of the sound wave, and the value currently touched by the algorithm would be played in each step.

Of course you could still pick arbitrary values and arbitrary start orderings.

noncee22343
No. Under some simple guidelines, which the model follows, the sorting algorithms won't sound like just about anything.

If you sort random permutations of the values [1, n], and map some monotonic property to the values, then not only are there provably some sounds which certain algorithms make that others don't, but more generally there are 'average case' signatures for each algorithm that give them their own recognizable cadences, and that is exactly what this video is demonstrating.

That you can use a 'boop' or a 'beep' or 'buzz' or invert the monotonicity is obvious and irrelevant.

HN Theater is an independent project and is not operated by Y Combinator or any of the video hosting platforms linked to on this site.
~ yaj@
;laksdfhjdhksalkfj more things
yahnd.com ~ Privacy Policy ~
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.