News for hackers. Stuff that matters.

Ask HN: Most creative algorithms?

I recently stumbled upon Sleep Sort[1, 2], which is the most creative algorithmic idea I think I have ever seen in code.

I'd love to read about more creative algorithms and code snippets like this, what else is out there? And I don't mean obfuscated code (although they often do include very creative ideas too).

[1] https://rosettacode.org/wiki/Sorting_algorithms/Sleep_sort

[2] https://news.ycombinator.com/item?id=2657277

( 2 comments | 9 points | on HN )
Re:Ask HN: Most creative algorithms? by r_transpose_p on Thursday May 12, 2016 @02:26PM (#11685625)
I'm partial to

https://en.wikipedia.org/wiki/Disjoint-set_data_structure

It's a fairly simple algorithm to implement, but there is some wicked-cool analysis behind how fast it is.

It's a super good thing to have in your toolbox for any time you want to do any sort of "simultaneous flood-fill everywhere" or "partition everything" task.

Re:Ask HN: Most creative algorithms? by kooshball on Tuesday May 10, 2016 @05:37PM (#11670872)
Another interesting sorting algo https://en.m.wikipedia.org/wiki/Spaghetti_sort