Y
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
textminer
4819 days ago
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!
link
masklinn
4819 days ago
It's an adaptive mergesort-based sort:
http://en.wikipedia.org/wiki/Timsort
link
gnuvince
4819 days ago
Still, I'd rather have a loop and be linear than using a sort and being linearithmic.
link