top | item 7291421

Rainbow Sort Visualisations

170 points| lolo_ | 12 years ago |ljs.io

51 comments

order
[+] allochthon|12 years ago|reply
Really nice. The examples suggest to me that a lot of algorithms would be more accessible to people if they could be visually represented in some way. The timing is important -- the slowness of the bubble sort compared to the quickness of the quick sort gives one an immediate sense of why one would generally want the latter over the former.
[+] izzydata|12 years ago|reply
Often it has to do with speed of implementation and a data set that is small enough for negligible difference. There is also an issue of whether the algorithm keeps duplicate ordering intact.
[+] GhotiFish|12 years ago|reply
I'm seeing waaaay too much stuff happen all at once for quicksort. Frankly, most visualizations give you an inkling as to the logic behind an algorithm, but quicksort just sort of pops the field into the correct order in a blur.

Another classic sorting algorithm to visualize is heapsort.

[+] lolo_|12 years ago|reply
Try turning down the block size (the value that defaults to 20), that will make it far slower - try 5.

I know that isn't too obvious, but this was something of a quick hack :)

[+] saw-lau|12 years ago|reply
I love this as a visualisation. It would be great to provide links to the algorithms (if they were there, I didn't find them).
[+] thedufer|12 years ago|reply
Interestingly, I just migrated my Sorting Visualizer off of GAE this weekend. Its kind of similar - more customizable, much less attractive: http://aarondufour.com/
[+] primitivesuave|12 years ago|reply
This is excellent and a great teaching tool. I tried putting something like this together a while back as a Java applet for one of my classes but couldn't get the color ordering function to work correctly. Did you use HSB?
[+] mh_yam|12 years ago|reply
I almost got a seizure x(
[+] reg29|12 years ago|reply
Indeed, there should be a warning in the title. This can cause seizures.
[+] muffkin|12 years ago|reply
"what's this 20 do?" "I'll set it to 1 and see what happens" "oh" "." "." "." "no"
[+] lolo_|12 years ago|reply
Ha yeah, sorry about that! Quick hack, etc. etc.
[+] saxaholic|12 years ago|reply
Very cool! I second all the suggestions of adding more sorting algorithms. I might just try to recreate this myself in Processing.js...
[+] izzydata|12 years ago|reply
Cool, bubble sort at (1) froze my tab.
[+] lolo_|12 years ago|reply
Yeah, I will probably work on fixing that :) quick hack, etc. etc.
[+] pekk|12 years ago|reply
How many times do we need to re-implement sorting?

Why do we educate students to re-implement sorting again?

[+] dpe82|12 years ago|reply
Because sometimes it's important to understand what your computer is doing for you.