Recursively traverse linked list -- help!
Paul Rubin
phr-n2002a at nightsong.com
Tue Feb 19 04:29:36 EST 2002
O Polite <ol1 at v10a.com> writes:
> Well, first you'd want to have a way of representing a linked list.
> Here's one straighforward way of doing it, but unless your taking
> Datastructures 101 you'll never be interested in it. The builtin list
> type will always be faster than anything you implement in python, and
> now in python2.2 you can subclass the builtin types as any other class.
That's a misconception. One of the main reasons for using linked
lists is to be able to insert stuff in the middle taking a constant
amount of time. If you do that with a built-in list, the time needed
is proportional to the size of the list, which can be very large.
More information about the Python-list
mailing list