Linked List – Data Structures & Algorithms Tutorials in Python #4

///Linked List – Data Structures & Algorithms Tutorials in Python #4

Linked List – Data Structures & Algorithms Tutorials in Python #4

FavoriteLoadingAdd to favorites

Linked list is a data structure similar to array in a sense that it stores bunch of items. But unlike array, linked lists are not stored in contiguous memory locations. They are instead chained by an element storing address location of next element. This makes insertion very easy. Also unlike dynamic arrays you don’t have to pre-allocate some memory capacity. In this tutorial we will go through some theory first and then write python code to implement linked list. In the end we have an interesting exercise for you to solve.

Code:
Exercise Link:

Topics
00:00 Introduction
00:18 Issues with arrays that linked list solves
05:54 Doubly linked list
06:37 Big O analysis (array vs linked list)
08:02 Python implementation
26:00 Exercise

#linkedlist #pythonlinkedlist #datastructures #algorithms #python

Next Video:
Previous video:
Complete playlist:

Website:
Facebook:
Twitter:

source

By |2021-08-02T15:26:29+00:00August 2nd, 2021|Python Video Tutorials|36 Comments

36 Comments

  1. Rishabh Dwivedi August 2, 2021 at 3:26 pm - Reply

    Kindly explain to me why are you using if name == main syntax. It is of no use in your code file. Because you are executing it directly.
    That syntax is for when you import the file.
    So, why this unnecessary syntax?
    I've seen this used by people at GFG, codechef etc. I don't know why they use it. Like why are they trying to confuse the audience.
    It has no purpose when you are executing that directly.
    Stop it. It confuses people.
    Is there something about that syntax that I don't know? Please enlighten me!

  2. Shreyansh Sharma August 2, 2021 at 3:26 pm - Reply

    sir can you add a video on circular linked list

  3. Shipra Shetty August 2, 2021 at 3:26 pm - Reply

    Amazing thanks a lot❤️

  4. 20 Varsha Gajula August 2, 2021 at 3:26 pm - Reply

    Thankyou

  5. Akhilesh Sagar August 2, 2021 at 3:26 pm - Reply

    Sir, I have a doubt, while removing the node, in the while loop, when the "BREAK 'statement is executed (It should basically come out of the while loop, Right..) that means the next nodes won't be iterated. but how is it working here.. I'm a little confused with this..
    Can you please Explain me..
    (or)
    if I think im ryt,because the node is skipped to the next next node, the link is maintained from there on and hence no further need to iterate ..

    $Thanks in Advance !!..$
    and btw the videos are Very Interesting and helpful. And once u practice them its like "Where have i been these past years.."

  6. deepa m.g August 2, 2021 at 3:26 pm - Reply

    After all why are we creating Linked lIst class? In what scenario linked lists will be used in a python projects
    .?

  7. Senapati Entertainment August 2, 2021 at 3:26 pm - Reply

    Best tutorial on linked list oat.

  8. Akbar Ghurbal August 2, 2021 at 3:26 pm - Reply

    One of the best tutorials on linked-list I've ever seen!

  9. Madhura Gore August 2, 2021 at 3:26 pm - Reply

    Great video series for DS and Algos in python!! Everything is explained really well!
    I had a doubt regarding the implementation of a doubly-linked list. Since it has 2 pointers, as per my understanding it should have a head and a tail. I implemented the same for the exercise question. But while cross-checking the solution, I noticed that you have not included a tail pointer.
    Any specific reason for this? OR I'm missing on something?

  10. Meenakshi S August 2, 2021 at 3:26 pm - Reply

    It is not executing in anaconda

  11. Harsha gurijala August 2, 2021 at 3:26 pm - Reply

    explain the use of this line->
    if _name_ == '__main__' :

  12. Gilbert Donell Chen August 2, 2021 at 3:26 pm - Reply

    I got antivirus

  13. 18-4050-Kumaran P August 2, 2021 at 3:26 pm - Reply

    "Let's test this method" is what he intended to say but "Let's taste" is what that is coming out.
    BTW the lecture was so nice what makes it even more special is that its in python unlike the normal C.

  14. Ritvik Ranjan August 2, 2021 at 3:26 pm - Reply

    I have a Doubt. In the program does self.head
    represent the full head node or only the data of the head node? Plz help me on this

  15. IT PREPARE & JOBS August 2, 2021 at 3:26 pm - Reply

    ALERT:::::: People who are beginner like me , 1ST understand class and objects PROPERLY .Then understand the logic by watching the implementation of linked list using c/c++ . then come back .. BHOOM everything goes straight into the head

  16. Innocent A August 2, 2021 at 3:26 pm - Reply

    Amazing!!

  17. Mannam Ramakrishna August 2, 2021 at 3:26 pm - Reply

    the black theme u are using is discomfort for the viwers

  18. Vivaan August 2, 2021 at 3:26 pm - Reply

    Sir very good explanation, but when we insert node at end from empty list then in while loop we have to use itr.next condition instead of itr, because if we use itr and insert second node after head then it will assign itr to None and exit and just after that we are assigning node address to itr.next which will give error :: 'NoneType' object has no attribute 'next', as here itr is None and None.next cannot be assigned. Please correct it.

  19. Jahid Hasan August 2, 2021 at 3:26 pm - Reply

    It's a good lecture but why my coding skill sucks… can't even implement anything on my own…still struggling a lot ???

  20. a k August 2, 2021 at 3:26 pm - Reply

    Big brother you are angel for us for all these courses

  21. Rifat Hasan August 2, 2021 at 3:26 pm - Reply

    Can you please explain how can you use the 'next' from the LinkedList class? The reference variable 'next' is a property of Node class. Thank you.

  22. jaswant gupta August 2, 2021 at 3:26 pm - Reply

    Best tutorial I have come across. Enjoying it and revisiting the DS to enhance my skill. Loving it.

  23. Ho Yin Li August 2, 2021 at 3:26 pm - Reply

    excellent explanation!

  24. Harshit Lamba August 2, 2021 at 3:26 pm - Reply

    This code will work perfectly if we have insertions/deletions as you have shown in the video. If we do say two insertions, one deletion somewhere in the list, then again insertions, and deletions, the code will break as the self.head changes the location. Is the observation correct?

  25. Sonali Thakker August 2, 2021 at 3:26 pm - Reply

    Thank you

  26. Nitin Magdum August 2, 2021 at 3:26 pm - Reply

    Can you provide short notes on it? It will help me….if anyone got notes please send me on nitinmagdum111@gmail.com

  27. aaron aaron aaron August 2, 2021 at 3:26 pm - Reply

    What a lecture!!!! Thanks !!! ????

  28. meme24x7 August 2, 2021 at 3:26 pm - Reply

    i love your virus very much…thank u so much for providing execises………….

  29. Prak EnTech August 2, 2021 at 3:26 pm - Reply

    Exercise Solved –
    def remove_by_value(self,val):

    itr=self.head

    c=0

    while itr:

    if itr.data==val:break

    itr=itr.next

    c+=1

    itr=self.head

    c,d=0,c

    while itr:

    if c==d-1:

    itr.next=itr.next.next

    break

    itr=itr.next

    c+=1

    def insert_after_value(self,dataAf,val):

    itr=self.head

    c=0

    while itr:

    if itr.data==dataAf:break

    itr=itr.next

    c+=1

    c,d=0,c

    itr=self.head

    while itr:

    if c==d:

    node = Node(val,itr.next)

    itr.next=node

    break

    itr=itr.next

    c+=1

  30. Ryan Astaphan August 2, 2021 at 3:26 pm - Reply

    You are the man. Thanks for your videos!

  31. Rishabh singh August 2, 2021 at 3:26 pm - Reply

    sir i m doing dsa in python is there is good??aur i shift in other language but i love python and thats why i take data science in my minor can u suggest me please and btw i love ur tutorials!!! thanxx for this video

  32. JITHIN D MATHEW August 2, 2021 at 3:26 pm - Reply

    The content is really great but can you change the theme ? It would make the content slightly more readable.

  33. தமிழன் August 2, 2021 at 3:26 pm - Reply

    I think insertion and deletion in the middle of array is difficult, which is easy in linked list

  34. Sarvesh Agarwal August 2, 2021 at 3:26 pm - Reply

    This is by far the best Linked list explanation I came across. Thank you so much for the great video!!

  35. Gautam Bagra August 2, 2021 at 3:26 pm - Reply

    How to pop an element out of a linked list

  36. malyadri yathapu August 2, 2021 at 3:26 pm - Reply

    i was not able to understand what is Self and why we are using that Self in function arguments and what are all the uses of self related methods like self.head? Please explain

Leave A Comment

*