How can I create a linked list in Python?
Gabriel Genellina
gagsl-py at yahoo.com.ar
Tue Jan 16 20:55:19 EST 2007
At Tuesday 16/1/2007 17:07, Dongsheng Ruan wrote:
>Thanks for your kindly help.
>I am new CS student taking datat structure and algorithms with AHO's book
>with the same title.
>
>The book is done in Pascal, which might be an outdated language.
>
>However, my instructor probably wants us to understand the list ADT better
>by not using the built in list in Python.
Just use the same structure as the book. Instead of nil, use None;
instead of new(P) where P:^Foo, use P=Foo(); records become classes
without methods...
Anyway, implementing linked lists, dictionaries, and other basic
structures in a language like Pascal, or C -which doesn't have them
natively- may be a good learning exercise. But doing that in Python
is not a good idea. Of course, using Python in a second or third
algorithms course *is* a good idea, because you can forget about
these implementation details and concentrate on the algorithms.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list