pulling set of unique values from a list
Erik Max Francis
max at alcyone.com
Wed Jan 14 15:03:23 EST 2004
Ben Davies wrote:
> personally I prefer the dictionary one-liner, but with the second
> iterative
> way it is probably more obvious what the code is doing (and perhaps
> more
> efficient?).
No, the dictionary method is more efficient. The list-using algorithm
has O(n^2) behavior, whereas the dictionary-using algorithm is only
O(n).
--
__ Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
/ \ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
\__/ You can't expect to win unless you know why you lose.
-- Benjamin Lipson
More information about the Python-list
mailing list