Live data from Hacker News

Rainbow Sort Visualisations

ljs.io

41–50 of 53 posts

Re: Rainbow Sort Visualisations

#42
post #18

Earlier 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?

Radix sort is one of those tricks that doesn't help often, but every once in a while can produce spectacular results. Here it is showing a 4x speedup on a particular operation in git:

https://github.com/git/git/commit/8b8dfd5132ce91f632b5303c39...

Re: Rainbow Sort Visualisations

#43
post #26

Earlier quoted context omitted.

I looked through the code, I see why quicksort is such a blur now, and I don't see an obvious way to fix it. Since you are in a sense, benchmarking these algorithms. 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…

I really need to jump back into the code, not looked at it for a while and take a look at improving how 'fairly' it benchmarks the algorithms. That's an interesting suggestion, will experiment with it. Thanks for your kind comment on the code qual :) personally I only see the faults, for one I am sure I could improve perf... year-old code is often that way however! :)

I tried to implement shell sort in your system. Shell sort is much like quick sort in that it kind of divides and conquers. (you can see my horrid first timer work here: https://github.com/Ghoughpteighbteau/Rainbow-Sort )

My estimation is that you need to refactor the algorithms such that they hold their state inside a closure, and break after a set number of swaps. Say every 300 swaps they break and the canvas updates. This kind of background processing is such a pain in javascript.

Re: Rainbow Sort Visualisations

#45
post #18
post #17

Reminds me of this: https://www.youtube.com/watch?v=kPRA0W1kECg

Dude, don't tempt me to add sound :P

I've played with sound as well with sort visualizations - it has been disappointing and more irritating than enlightening, but maybe there's a proper angle on it somebody will find that adds to the understanding of the algorithm.

And as the others have said - your rainbow viz is really nice, in a lot of ways :)

Re: Rainbow Sort Visualisations

#46
post #37

Earlier quoted context omitted.

I looked through the code, I see why quicksort is such a blur now, and I don't see an obvious way to fix it. Since you are in a sense, benchmarking these algorithms. 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…

Yes, but it should use two spaces for indentation, not a tab; according to coffeescript guidelines.

strange downvotes:

the statement is true and informative: https://github.com/polarmobile/coffeescript-style-guide#tabs...

to someone who was just learning about coffeescript.

Re: Rainbow Sort Visualisations

#49
post #45
post #18

Earlier quoted context omitted.

Dude, don't tempt me to add sound :P

I've played with sound as well with sort visualizations - it has been disappointing and more irritating than enlightening, but maybe there's a proper angle on it somebody will find that adds to the understanding of the algorithm. And as the others have said - your rainbow viz is really nice, in a lot of ways :)

I find this visual+audio version both entertaining and genuinely useful as tracking changes in multiple sounds at the same time that quickly, combined with the visual process gives more tangibility to the algorithm. Plus the punchline was unexpected and fits well to a "credits" part.
Post reply on HN