Hacker News new | comments | show | ask | jobs | submit login
Sorting algorithms compared and animated (sorting-algorithms.com)
87 points by nreece 2728 days ago | hide | past | web | 17 comments | favorite

I've always thought that sorting algorithm visualisation could be done better in static images than animation. Here's a blog post on the topic I prepared earlier... ;)


This is so much good of an idea.

I remember seeing the exact same animations original poster linked to, no less than ten years ago. I recognize their visual form distincly, because of how they've set back my understanding when I was learning this stuff.

There is no limit to pagerank you should receive for preparing this.

What I like about the animated approach is showing insertion and bubble sorting beating the others on a nearly sorted set. It's not just a question of what's the best in average or worst case situations but also what format is your data starting out as.

Edit: It's not that the other approach can't show the same information rather it takes up more space so it's harder to notice new relationships other than those directly shown.

Fantastic post!

Thanks for including the source you used to generate those, too. :)

This is one of the best things I've seen on HN in a long time. What a great idea!

(Doesn't work when I increase the size to 50 though.)

Whole heartedly agree. That this article can make front page is the reason HN gets the majority of my reading time each day.

No offense, but "long time" is the operative phrase. It's old.

That's ok by me. I tend not to consume the entire output of the internet every year.

But you hang out on HN. The N stands for News.

New to me suffices.

Another page with sorting algorithms animated (with some other algorithms): http://www.cs.ubc.ca/~harrison/Java/sorting-demo.html

Thanks for the link it was a good read, this is a good one too, it shows some stats as the sorting operation is happening: http://coderaptors.com/?Sorting_algorithms

Here's another page with more algorithms: http://home.westman.wave.ca/~rhenry/sort/ Has some fun ones like Stooge sort and Several Unique sort.

This would make an awesome test question - show the animation and name the algorithm.

wonderful, I want to email this to some of my old professors.

This is also a great page to explain to normal people how computers actually work.

This is great. I wish I could upvote again and again.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact