Data Structures in Python: Doubly Linked Lists -- Delete Node

preview_player
Показать описание
In this video, we consider how to delete, or, remove nodes from a doubly linked list. Once we cover the concept of how to perform this action, we follow through with a Python implementation.

The software written in this video is available at:

Do you like the development environment I'm using in this video? It's a customized version of vim that's enhanced for Python development. If you want to see how I set up my vim, I have a series on this here:

If you've found this video helpful and want to stay up-to-date with the latest videos posted on this channel, please subscribe:
Рекомендации по теме
Комментарии
Автор

I just found this series. I wish you were still uploading. Love your explanations. Some how they just click

jsotogaming
Автор

me two hours before the deadline... yep I am dead. Thanks for saving my grade a little

gravkint
Автор

The best explanation of list . Thanks sir

mantuddude
Автор

Is there any way to download that PowerPoint document, I found it very helpful and would like my own copy of it to review? Great videos!

keys
Автор

Is it necessary to assign None to cur.next an d cur.prev... Wont assigning cur = None do the job... That is if the node is gone there will be no beed to assign node again to the next and prev..

arjunreddy
Автор

What if in the third case of the delete method we just say 'cur = None' to kill it and don't use the two statements mentioned above(cur.next=None, cur.prev=None)? Won't it kill the node directly as None can't have any attributes?

muskaandhawan
Автор

Thank you! 1 Q, is cur = None sufficient or is it required to do cur.next = None and cur.prev = None

axygh
Автор

i know this is unrelated but what editor are you using? all i know is that it's terminal-based but i can't figure out what it is

coxless_persian
Автор

here's my understanding of the 4 cases :)
All 4 cases share the condition where the data in the node matches up with the key we're interested in ...then, we split the nodes up into 4 separate cases, according to the position of the nodes in the list. Whether the node is in the first position (or not) and whether the node is in the last position (or not) (2*2=4 cases)
common condition: curr.data == key
1st condition: is the node (whose curr.data==key) the head (first position) or not the head of the list? (2 ways--the Boolean condition to check for this is to check whether the curr==self.head or not. Since the first node must point towards None)
2nd condition: is the node the tail (last position) or not the tail of the list? (another 2 ways. The Boolean condition to check for this is to check whether curr.next == self.head or not. Since this is a circular list, the last node should point back to the first node)

khbye
Автор

the fourth case when the last node we have to delete. after doing prev.next=None.why we have to do cur.prev=none and cur=none??
does doing prev.next is not enough???

sachinnegi
Автор

cur = None is sufficient. cur.next = None and cur.prev = None are redundant

majesticflyingbrick
join shbcf.ru