No trees in the stdlib?
Paul Rubin
http
Fri Jun 26 07:15:48 EDT 2009
Chris Rebert <clp2 at rebertia.com> writes:
> > Simple example usage case: Insert string into data structure in
> > sorted order if it doesn't exist, else retrieve it.
>
> That's pretty much the bisect module in a nutshell. It manipulates a
> sorted list using binary search.
That lets you find an existing entry in log(n) time, but inserting
or deleting an entry still takes linear time. Also, you don't
get a persistent structure in the sense of functional programming.
More information about the Python-list
mailing list