Jump to content

Sorting algorithms set to music


Recommended Posts

Ok, this is cool. It's not exactly LV, but it is computer science, and since LabVIEW is dedicated to making CS more accessible to non-programmers, I decided this fits the Design & Architecture theme.

Background: There are different processes that can be used to sort data. Some LV users may just know the Sort 1D Array primitive, but under the hood, that primitive implements a particular sorting algorithm. Different sorting algorithms have different performance characteristics. Some algorithms are categorically worse than the others. Some are really efficient on different types of data -- some work well when the data is completely random, others when the data is already nearly sorted, some are very efficient when the data is too large to fit in memory and has to be occasionally loaded from disk.

Understanding what is actually going on with each algorithm is sometimes hard to grasp for students, especially if they're just reading source code. Someone has taken various sorting algorithms and set them to music and video. How? He sorts an array of randomized numbers, and every time two values are compared, he plays a tone of the frequency of the value. For some sorts, as the array gets closer to sorted, you can hear the sound becoming ever more like a single rising scale. For other sorts, it gets closer to silence since those sorts don't have to keep checking back to see if they have all the data sorted.

Here are the Youtube links:

Insert, bubble, selection, merge, and a gnome sort:

Heap sort:

  • Like 1
Link to comment

Something related:

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/1QHzI5HmXl4" frameborder="0"></iframe>

Yeah, I know those as well. Always preferred Bach's Toccata and Fugue in D minor:

One thing which helps connect these even better is to place a piece of paper on the screen which shows you exactly where the music is currently (i.e. the edge of the paper is on the center of the screen).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.