get method

James Mills prologic at
Tue Dec 30 23:32:13 CET 2008

On Tue, Dec 30, 2008 at 7:10 PM, Roel Schroeven
<rschroev_nospam_ml at> wrote:
> Hm, you just changed an O(n) algorithm to an O(n**2) algorithm. No big
> deal for short strings, but try your solution on a string with length
> 10000 and see the difference. On my computer the O(n) version takes
> 0.008 seconds, while your version takes 8.6 seconds. That's 1000 times
> slower.

Yes you are right :) Sadly :/

I wonder if there is a way to implement
the same thing with close to O(n)
complexity using list/dict comprehensions.


More information about the Python-list mailing list