Python: Doubly Linked Lists

preview_player
Показать описание
Doubly linked lists implemented in Python. Bidirectional linked-lists demo example.

PYTHON LINKED LISTS

Рекомендации по теме
Комментарии
Автор

thanks a lot Joe, clear graphs and codes really helpful for understanding

francis
Автор

Thnx Joe. Could you check in the remove method, if the else clause (prev is None) is correct?. I think that self.root must be made equal to next because this_node is being removed.

agmaeso
Автор

This is helpful, thank you for sharing!

smilefaxxe
Автор

In line 56 shuldn't be self.root = this_node.get_next() ? Without this step the single element will not be removed.

piotrmodlinger
Автор

What's the difference of this and an index enumerated list and get prev and next by list[index -1 and +1] during the iteration ?

agroforestryconsultancyroz
Автор

Shouldn't root be next in remove?

alexanderrosenbergjohansen
Автор

There is a problem, doubly linked list should remove any node in O(1). I think the remove method's parameters should be a node, not a data.

Matt-prye
Автор

Thanks Joe, Excellent clean efficient code

HP-vyis
Автор

Hi Joe, just wondering if it was at all possible to store data on the edges between each node? I'm looking to store an integer.

DCentFN
Автор

I'm first example from linked list ( image ) .
, the root don't was to be the data from first node?

Because when get the root ( using your example ) would return None, and define the root to first node returning the data attribute.

MarlyssonSilva
Автор

Hi! I was wondering what the purpose of the "else: self.root = this_node " near the end of the remove function is

raduandreicosmin
Автор

Hi, I want to ask you if you know how to print the bidrectional list from the end to beginning?

elzbietakrzeczek
Автор

how many and what use cases would fit going down this low level?

dmitri
Автор

can you please add print function as well it wuld be great if you add that as well

gouthampratapa
Автор

how to do it without Object oriented programming

parthpandya
welcome to shbcf.ru