Recursively traverse linked list -- help!
ol1 at v10a.com
Wed Feb 20 04:29:49 EST 2002
On Tue, 2002-02-19 at 23:10, Gustavo Niemeyer wrote:
> Hey!! That's not fair:
> > inserts at start of LinkedList
> > 20000 0.457922101021
> > inserts in middle of builtin list
> > 20000 0.787240982056
> You're comparing oranges and bananas here... ;-)
Well actually it is fair, because the insertion time for the linked list
is constant, as long as you have a handle to the insertion point. That's
pretty much the reason for using it. Inserting at the start will be just
as fast/slow as inserting in the middle. I just didn't feel like
rewriting the class so that it would take an arbitrary insertion point.
Paul was right all along.
More information about the Python-list