Hacker News new | ask | show | jobs
by textminer 4819 days ago
The pedant in me squirms at seeing a quadratic-time solution to something so linear. Use a heap or a scan, sir!
1 comments

Oh, now I have to yell at myself. No doubt Python's sorted is some n*logn quicksort, and not actually in quadratic time. Crow for all!
It's an adaptive mergesort-based sort: http://en.wikipedia.org/wiki/Timsort
Still, I'd rather have a loop and be linear than using a sort and being linearithmic.