Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Mergesort is best because it is the most elegant and beautiful sorting algorithm. Just merge lists so that they stay sorted.

Quicksort has all sorts of nonsense bouncing around and picking pivots. Eww. Terrible.

I will admit that I could have been more clear that I was evaluating algorithms based on beauty, but given that info I’m sure the conclusion is obvious.



Now build me a selection algorithm out of mergesort.

Just the other day I sped up a process by an order of magnitude because someone was sorting to do weighted median selection. Which is easy to build on top of std::nth_element. Top-k is another common need.

Quicksort is still worthy today also because of this.


Or you could just have people study QuickSelect and gain the same benefit without wasting on a slower sorting method when taking into account cache etc.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: