Earlier quoted context omitted.
Thanks :D This was just a quick hack a year or so ago, am open to enhancing it though - feel free to post any suggestions over at https://github.com/lorenzo-stoakes/Rainbow-Sort/issues :)
Add bogo sort and gnome sort.
Rainbow Sort Visualisations
11–20 of 53 posts
Re: Rainbow Sort Visualisations
#12Really 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.
Re: Rainbow Sort Visualisations
#13Re: Rainbow Sort Visualisations
#14I'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.
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 :)
Re: Rainbow Sort Visualisations
#15Re: Rainbow Sort Visualisations
#16I'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.
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 :)
One way to do it might be to allow the user to set the timeout in your defer function.
Setting the timeout to 1 second lets the user observe each run of your algorithms. You can see the partitioning behaviour a bit better like that.
Side note: this code is pretty. I should learn coffeescript.
Re: Rainbow Sort Visualisations
#17Re: Rainbow Sort Visualisations
#18Reminds me of this: https://www.youtube.com/watch?v=kPRA0W1kECg
Re: Rainbow Sort Visualisations
#19Re: Rainbow Sort Visualisations
#20Earlier quoted context omitted.
Dude, don't tempt me to add sound :P
Sound is cool at first but then gets way annoying. I had never heard of radix sort, 0 comparisons. Are you planning on adding more sorting algorithms like mergesort?
I did this as a quick hack on a whim about a year ago (was a visualisation I wanted to see but couldn't find one quite like this), I am pleasantly surprised by the positivity on this (I kinda posted it on a whim), so I think I will probably hack on it again :-)
It's tempting to code up a whole bunch of sorting algorithms, merge and heap sort are definitely high on the list.