Python Data Structures #2: Linked List

preview_player
Показать описание
Code below (some minor improvements have been made since the video was released)... In this video we'll begin by discussing the basics of the linked list data structure, and towards the end, we'll move over to a coding editor to implement the ideas in Python code. In this video, as well as the last, I am using Python 2.7. For some reason, I was talking fairly slow in the beginning so you may want to up it to 1.25x speed.

(PYTHON 2)

(PYTHON 3)

****

In computer science, a linked list is a linear collection of data elements, in which linear order is not given by their physical placement in memory. Each pointing to the next node by means of a pointer. It is a data structure consisting of a group of nodes which together represent a sequence. Under the simplest form, each node is composed of data and a reference (in other words, a link) to the next node in the sequence. This structure allows for efficient insertion or removal of elements from any position in the sequence during iteration. More complex variants add additional links, allowing efficient insertion or removal from arbitrary element references.
Рекомендации по теме
Комментарии
Автор

@Brian Faure. Thanks for your tutorial. I really appreciate for your efforts to make this tutorial. After watching your vedio, I am confused by one thing. The append function doesn't show the great advantage of the linked list. Could you give us more explanation about this. I think one great merit for linked list is: when we want to insert a node into the list, it just need to change the pointer instead of moving the items in the list to create an gap and then inserting the new item into the list. In the linked list, when we want to insert an node, we just need to change two pointers, which helps us save time, especially the list contains millions of node. But your append function, it needs to iterate to find the last node and then add a new node. This doesn't show the virtue of the linked list. So I am think about the append function whether we could just add the new node at the end of the linked list without iteration. Thanks for your help.

Noooname
Автор

3:40 node class, 5:00 linked list class, 6:12 linked list-APPEND method, 7:55 linked list-get LENGTH method, 9:22 linked list-DISPLAY LIST method, 11:31 linked list-get DATA method, 14:50 linked list ERASE method

domss
Автор

I struggled a lot with DSA until I found this channel. Now I struggle a lot less thanks to you.

LemesaElias
Автор

5 years later and this is still a great video! Awesome in-depth explanation.

MCMB
Автор

I was a beginner and struggled a lot for the right content and pace which suited me. I have started watching your videos and I must say the concepts are taught very well. At most places I see people just giving presentation through slides and your videos teach us how to implement them. My request to you is to please put more videos in this very playlist covering topics such as Heaps, Recursion etc . Basically the topics which you have'nt uploaded here. You're doing a great job sir. Your efforts can make someone's career. Someone like me. Thank you and have a nice day !

codecode
Автор

i must say, this is the simplest coding of linked list i've seen so far on the internet

Julia-rquj
Автор

This man deserves an award for how well he broke down every concept!

gabrieldewraj
Автор

I have searched through Youtube to find someone to explain Linked lIsts and I gotta say, your video was the most helpful. Thank you so much!

austinbao
Автор

I know this is more geared to beginners but a better way to do length for an object is by levying your own dunder method or "magic method". You can do this by defining your function as: def __len__(self): this will let you leverage the length of your linked-list by using len(your_linked_list) rather than using your_linked_list.length(), which will be more pythonic and user friendly. You could also use def __getitem__(): for yor get function.

tguigz
Автор

I love you dude thanks for explaining this stuff so clearly. So many other channels explain this stuff so badly, but you make it so easy to understand.

djlazer
Автор

First dsa video! the keyboard sound was just 🤩

ETR
Автор

Agree. The current appending solution is O(n) not O(1). Your solution should be O(1), which is the benefits of using Linked List
.

yunsizhang
Автор

Your explanation is too clean and lucid.Thanks for a great video!

softwareengineer
Автор

beleive me you are one of the greatest teacher of coding. oh its true, ,,its dammmnnn true... keep it up.

zulfiqarali
Автор

Excellent video, really clear, direct, concise and easy to follow. Amazing, so many people on YouTube need to learn a thing or two from you.

mouseen
Автор

Extremely helpful tutorial! Clear, concise presentation. And Python is also my favorite language!

alexlencz
Автор

I'm a beginner at coding and this was very helpful. I also liked the cadence of your voice, it helped me from not zoning out. Keep it up!

MrBloodshadow
Автор

my_list = LinkedList()
my_list.append('3 years later but still great, thanks Brian')
my_list.display()

jpchato
Автор

Thank you for making this great tutorial, it's very helpful! I've been struggling with understanding the linked list structure and finally find answers from your video, thank you very much!

yajingli
Автор

I love your tutorials. I wish I could have discovered them before starting CS110 three months ago. Keep up the great work

patrickmutuku