News for hackers. Stuff that matters.
Re:Sorting Algorithm Animations by drawkbox on Sunday December 12, 2010 @03:15PM (#1997887)
Yes I saw that it was posted before and reposted based on some recent sorting articles because it is so helpful. It is like Asimov's 'The Last Question' and 'How Software Companies Die' and others because it is very interesting.

An interesting static visualization from the other threads is here : http://www.hatfulofhollow.com/posts/code/visualisingsorting/...

I think seeing the timing and sorting in action is so helpful to understand what is going on.

Re:Sorting Algorithm Animations by tel on Sunday December 12, 2010 @05:56PM (#1998370)
Out of curiosity, are you keeping a log of popular HN posts or just remembering them and searching? You're always first on the scene and comprehensive, it seems.
Re:Sorting Algorithm Animations by RiderOfGiraffes on Sunday December 12, 2010 @06:32PM (#1998481)
I remember and search. My memory's pretty good, and my search-fu is also usually pretty good, although not always.

I'm currently looking at automating some of the process, but I do find that searching for stuff I think I remember occasionally turns up a gem I missed, and so I'm reluctant to automate it fully unless they still get found.

That's why I'm starting to feed items into a Bayesian classifier to find good stuff - by my standards and according to my interests. I continue to experiment.

Re:Sorting Algorithm Animations by tel on Sunday December 12, 2010 @11:49PM (#1999372)
I'd love to hear more details on your classifier. I've been interested in trying something like that for myself: a sort of automatic attention filter which brings both unmodeled outliers and probably-good articles to my attention.
Re:Sorting Algorithm Animations by siddhant on Sunday December 12, 2010 @02:42PM (#1997793)
Here's what different sorting algorithms sound like - http://www.youtube.com/watch?v=t8g-iYGHpEA

Bubble sort takes the most time. :)

Re:Sorting Algorithm Animations by InclinedPlane on Sunday December 12, 2010 @04:07PM (#1998018)
Only because bogosort wasn't tried.
Re:Sorting Algorithm Animations by bajsejohannes on Sunday December 12, 2010 @02:46PM (#1997803)
Another approach for visualizing sorting algorithms is http://sortvis.org/
Re:Sorting Algorithm Animations by bballbackus on Sunday December 12, 2010 @09:12PM (#1998932)
So is there an ideal case for selection sort that isn't shown or does it just suck?

Edit: Never mind they explained:

From the comparions presented here, one might conclude that selection sort should never be used. It does not adapt to the data in any way (notice that the four animations above run in lock step), so its runtime is always quadratic.

However, selection sort has the property of minimizing the number of swaps. In applications where the cost of swapping items is high, selection sort very well may be the algorithm of choice.

Re:Sorting Algorithm Animations by amichail on Sunday December 12, 2010 @04:27PM (#1998074)
In what sense are sorting algorithms more fundamental than say font rendering algorithms? Nowadays, they are both supplied in standard libraries and few programmers would implement either.
Re:Sorting Algorithm Animations by olalonde on Sunday December 12, 2010 @04:36PM (#1998105)
They are used in many more situations. A lot of problems can be reduced[1] to or contain a sorting problem. The same cannot be said about font rendering algorithms.

[1] http://en.wikipedia.org/wiki/Reduction_(complexity)

Re:Sorting Algorithm Animations by amichail on Sunday December 12, 2010 @04:40PM (#1998118)
Rendering text is even more useful than sorting.
Re:Sorting Algorithm Animations by olalonde on Sunday December 12, 2010 @04:57PM (#1998167)
You are right in the sense that there is no formal definition for what makes an algorithm fundamental (AFAIK - I am no expert on the matter). However, the general consensus seems to be that since a large number of problems make use of or can be reduced to a sorting problem, it is more fundamental than font rendering which solves exactly one problem. In fact, I wouldn't be surprised if font rendering algorithms use sorting in some way.
Re:Sorting Algorithm Animations by johnwatson11218 on Sunday December 12, 2010 @03:27PM (#1997922)
Are there any other algorithms that can have these kinds of animations applied? Sorting works well and is easy to animate. What about graph traversal or network flow? I guess my real question is 'can all algorithms be animated in some way'? If not what decides it? If there were more than 4 dimensions I could see that being a problem right there.
Re:Sorting Algorithm Animations by megrimlock on Sunday December 12, 2010 @03:29PM (#1997924)
What's the best way to instrument an algorithm for visualization? Snapshot its state at periodic, well-named points, and render illustrations?

I can imagine doing this with an A* search: snapshot the graph, including which nodes are open or already visited, along with the heap ranking of the next nodes to visit. You might also want to show all the newly neighboring nodes and annotate them with their updated cost estimate.

Re:Sorting Algorithm Animations by jmtame on Sunday December 12, 2010 @03:00PM (#1997844)
what, no love for bogosort?
Re:Sorting Algorithm Animations by ableal on Sunday December 12, 2010 @02:43PM (#1997798)
Aldo Cortesi has some striking images going on here http://corte.si/posts/code/sortvis-fruitsalad/index.html and here http://sortvis.org/

He explains his anti-animation rationale here: http://corte.si/posts/code/visualisingsorting/index.html

Re:Sorting Algorithm Animations by vijaydev on Sunday December 12, 2010 @02:22PM (#1997723)
Excellent work!