3 ms·
I actually agree with this remark: "In the talk.origins newsgroup someone made an offhand remark that they didn't see how anybody, no matter how klutzy their pr
by bquinlan 11y ago
I actually agree with this remark:
"In the talk.origins newsgroup someone made an offhand remark that they didn't see how anybody, no matter how klutzy their programming, could write an O(n^3) sort."
The examples were all constructed by smart people who are deliberately trying to invent slow algorithms. I don't think that a klutzy programmer would stumble upon any of them by chance.
The slowest sorting algorithm that I've seen in production was something like this:
def sort(l):
s = []
while len(l) > 0:
m = max(l)
s.append(m)
l.remove(m)
s.reverse()
return s
I looked like a hero when I reduced the main page load time for our biggest customer by 90% in one afternoon :-)