Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
I've been a software developer / educator for the past 22 years - considering this is free content, available to all, I would say this is one of the best (beginner level) explanations of the linked list data structure I've seen on RUclips - more power to you Sir
Hey, is this enough for placement technical round, I have minimum knowledge in DSA, and would this be enough to atleast implement the basic logic?. Please do reply.
Finally, an instructor willing to take it step by step and explain how everything works together without speaking too fast to make the student feel overwhelmed. Thank you!!!!!!
1:20 Difference between Static and Dynamic Array 1:00 Order of array insertion operations 3:00 Way dynamic array works 3:30 Linked List 5:00 Order of operation for linked list 5:30 Benefits of Linked list 6:30 Types of Linked list 7:00 The main advantage of linked list
I was searching for videos like these last year. I didn't find them. But I'm so so glad you did this. I will post it on my social media profiles, I'm sure it will help others too! Kudos!!
I've watched other DSA videos, but *I am glad that I found this DSA playlist in Python*, I can code side by side. Best part, it covers a variety of aspects, core fundamentals and all the whys before writing the code. Thank you!
You sir are a magician, the amount of things I learned in 30 minutes is unbelievable. Tomorrow I will have my Programming Introduction final exam and you saved my life on this topic. Best regards.
My first dive into programming a few years ago, I just learnt how to do things without really understanding why. Thanks for taking the time to not only explain what Linked Lists are, but why they are needed!
Thank you so much, sir. This is like the best tutorial I have come across and now am happy I now understand the implementation of linked lists in Python.
Quite honestly, I have coding interview with one of the FAANG in next two weeks, and I am practicing coding like anything, I have never worked this hard before. I am not sure why, I have liked your entire playlist like I have never liked any tutorials before! Thanks for making this life-saver tutorials! Big Thanks to you!
Rename itr with current_node and count with current_index and the code will be much more understandable! The explanation is really good but the naming could be more intuitive. Thanks for the video!
Woah! These videos are awesome. I've been trying out LeetCode problems on DS & Algo, but it was difficult for me to understand the solutions without a background in Java or C++. Your videos explain all the theory using only Python and that's extremely useful for Data Science professionals. Thank you so much :D
Thanks for the tutorial. I was looking for tutorials in which the tutor explain while writing codes. The exercises are super-awesome and I think everyone should go and try to solve it. It took me 30 minutes to solve the first exercise moving on to the next.
Love your training video and the swimming example at the end. I watched quite a few videos prior to yours and none of them makes sense until I come across this. Thank you!
I came across this series just trying to touch up on my data structures. You do a phenomenal job going into detail at a human level where anyone can understand. Thank you sir!
Great..! I have 7yr of experience. But still i am learning lot of new things from your side. This is what i was looking long time. Thank you so mush..!
Great video; I am preparing for an interview, and I am highly engaged with your tutorials, very easy to understand and follow, and I understood immediatelly how to do the first exercise, will be doing the second one soon as well. Thanks a lot!
You explained it very well. Thank You. Also if possible, please create a new playlist where you put some good exercise questions and coding challanges on Data Structures and Algorithms to prepare for coding rounds in placements.
Best explanation and proper way to make understand linked list .....❤️❤️ But for beginners , at first they have to know how linkedlist works but for the students who have some basic ideas about linkedlist ,can understand this
"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.
hey thanks much for pointing it out. I am not a native english speaker and I still make mistakes. I just watched some videos on taste vs test pronunciation and I think now I can pronounce them better.
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
I was coding along until at some point it got complex, so I decided to watch the whole thing first..but I dosed while watching..then for some reason I got up towards the end and heard @codebasics say...if you won't practice..forget it, you are wasting your time.. ouch, now I will have to start the video again **slapping my face**
Thank you so much for your efforts you've put in teaching us DS in simple way...Really appreciate your way of teaching...Have tried something from my side too so sharing the code for functions given for assignment... ``` def insert_after_value(self, data_after, data_to_insert): #check for first occurence of data_after and insert the value after it head = self.head pos = 0 isValExist = False while head: if head.data == data_after: if pos == self.get_length(): self.insert_at_end(data_to_insert) else: self.insert_at(pos+1, data_to_insert) isValExist = True break head = head.nextNode pos += 1 if not isValExist: raise Exception(str(data_after)+" Value doesn't exist in LinkedList") def remove_by_value(self, value): head = self.head pos = 0 isValExist = False while head: if head.data == value: if pos
excellent tutorial. The exercises at the end are great for re-enforcement of what is taught and application of the knowledge to take it one step forward. Great work. Thanks a lot.
great video, thanks a lot. However I have couple of minor comments: 1) it was good to mention that python deque is already implemented all these methods and more. 2) in the insert_at method, you should have check the index for being at the end, to use the insert_at_end instead of looping through all elements in the list.
Hey, nice tutorial thank you! I went for a recursive approach in implementing the linked list insert / delete methods. I also had a Class Variable to keep the total count of index it will increase by 1 when any insert is done while decrement by 1 when a deletion takes place, so I override __len__ method in Python and used that to give it a more generic list type vibes same for printing the list used __str__. I am currently trying to implement an additional argument tail inside, that will keep track of the last node, so so I don’t have to traverse to the end to insert making the time complexity for inserting / deletion at the end O(1)!! I also implemented other default list methods like: count, reverse, sort!! A great practise.
It's interesting to learn from such a great trainer. I'd like to point out one update to the program: We should not be using self.get_length() while inserting or removing an element. That call results in O(n) even to insert or remove at the beginning. Please correct me if I'm wrong.
I thought the same and I implemented this: def remove_at(self, index): if not self.head: return if index == 0: self.head = self.head.next return node = self.head _index = 0 while node: if _index + 1 == index: node.next = node.next.next return if not node.next: return node = node.next _index+=1
@@sava-lakicevic Yes, we can think in the algorithm order in the worst and best case. If we use the get_length method you will always have an O(n), but if you don't use it you can have a O(1) in the best scenario which is removing at the beginning. I don't think that you need to verify the index in the code that I wrote, because if index > len(linked_list) you will return null because you will exit the while loop before reaching the condition _index+1 == index
Majority of the comments are appreciating the class , so i think problem is with me😅 , even though i hav completed basics of python , still i did't understand the coding part class that u hav given in this video. Is i am not intelligent enough to understand this ? No matters , how hard it is ... No matters , how many times i failed.. i will try it again....😡
Sir, your conceptualization and teaching style are superb, and you present the material very effectively. However, I am facing difficulty understanding the coding part. Could you please consider providing more detailed explanations or dedicate future videos to thoroughly explain the coding aspects? This would greatly enhance my learning experience. Thank you.
I might be incorrect but i have a doubt. If there is already an element in the linked list and you will call insert_at_beginning method there is no link between the previous element and the new element because you are not linking, still it is printing because you are storing all the inserted elements in llstr. This will create a link between previous and new element temp=self.head self.head=Node self.head.next=temp in the insert_at_beginning method. @codebasics
Instead of traversing through the entire list to get size of the list. You can define a variable in the constructor function eg: self.counter, so whenever you add or delete a node just update the counter. And you can get the length of list in O(1) time complexity.
"Best way to learn something is by teaching it. " "One can't teach a subject which he don't understand well." Now the thing is you are amazing. And love from Bangladesh. Preparing for interviews pray for me.
An excellent remark... Actually, the insertion itself takes 1 unit ( O(1) ) but finding the place where to insert needs iteration, and here comes the O(n). Here he assumes u r not yet at the insertion place and you are going to look where to insert. But u r right.. insertion ONLY is O(1).
Do you want to learn python from me with a lot of interactive quizzes, and exercises? Here is my project-based python learning course: codebasics.io/courses/python-for-beginner-and-intermediate-learners
I've been a software developer / educator for the past 22 years - considering this is free content, available to all, I would say this is one of the best (beginner level) explanations of the linked list data structure I've seen on RUclips - more power to you Sir
👍🙏
Hey, is this enough for placement technical round, I have minimum knowledge in DSA, and would this be enough to atleast implement the basic logic?. Please do reply.
@@devendudileep1149 bro you need to practice more questions on leetcode or hackerrank to pass the tech interviews. this is very basic
Can't understand linked list 😢
Finally, an instructor willing to take it step by step and explain how everything works together without speaking too fast to make the student feel overwhelmed. Thank you!!!!!!
Glad it was helpful!
1:20 Difference between Static and Dynamic Array
1:00 Order of array insertion operations
3:00 Way dynamic array works
3:30 Linked List
5:00 Order of operation for linked list
5:30 Benefits of Linked list
6:30 Types of Linked list
7:00 The main advantage of linked list
I was searching for videos like these last year. I didn't find them. But I'm so so glad you did this. I will post it on my social media profiles, I'm sure it will help others too! Kudos!!
I've watched other DSA videos, but *I am glad that I found this DSA playlist in Python*, I can code side by side. Best part, it covers a variety of aspects, core fundamentals and all the whys before writing the code. Thank you!
You are a true teacher. Nobody tells us to learn like you do. I have followed your ML class and learnt ML and even cracked a job interview
This is by far the best Linked list explanation I came across. Thank you so much for the great video!!
I am happy this was helpful to you.
You sir are a magician, the amount of things I learned in 30 minutes is unbelievable. Tomorrow I will have my Programming Introduction final exam and you saved my life on this topic. Best regards.
Best of luck Rui and thanks for your kind words !
You are by far the best teacher of LinkedList implementation I have had so far. Thanks so much for making this understandable.
In about 25 minutes, I have learned more than what I've learned in 5+ class lectures.
Kinda same feel
the same!
My first dive into programming a few years ago, I just learnt how to do things without really understanding why. Thanks for taking the time to not only explain what Linked Lists are, but why they are needed!
Thank you so much, sir. This is like the best tutorial I have come across and now am happy I now understand the implementation of linked lists in Python.
👍🙏😊
This is a great tutorial I am currently enjoying and revisiting to sharpen my programming skills. Thank you!
This is the best-linked list concept explanation in Python ever I guess👌👌..... I love you, sir😭
Quite honestly, I have coding interview with one of the FAANG in next two weeks, and I am practicing coding like anything, I have never worked this hard before. I am not sure why, I have liked your entire playlist like I have never liked any tutorials before! Thanks for making this life-saver tutorials! Big Thanks to you!
I also have an interview with Turing... Please what resources are you using to learn??
@@sheyzi_ How did i went?
After fully understanding how it worked internally everything else became so easy!
Thank you
Glad it helped!
Rename itr with current_node and count with current_index and the code will be much more understandable! The explanation is really good but the naming could be more intuitive. Thanks for the video!
I couldn't understand this data structure. But after this video I was able to do all those methods inside Linklist class. Best teacher!
truly found a gem of channel for upskilling my data structures and algorithms and python skills. you have a long way to go sir.
Welcome aboard and thanks for your kind words! if you found this to be useful, feel free to share on linkedin,watsapp, facebook etc
I am loving this series of Data Structures & Algorithms Tutorials in Python. Thank you so much for such great explanation.
I'm amazed at how basic this stuff is when it is explained well.
Woah! These videos are awesome.
I've been trying out LeetCode problems on DS & Algo, but it was difficult for me to understand the solutions without a background in Java or C++. Your videos explain all the theory using only Python and that's extremely useful for Data Science professionals. Thank you so much :D
Glad you like them!
One of the best tutorials on linked-list I've ever seen!
Glad it was helpful!
Thanks for the tutorial. I was looking for tutorials in which the tutor explain while writing codes. The exercises are super-awesome and I think everyone should go and try to solve it. It took me 30 minutes to solve the first exercise moving on to the next.
Love your training video and the swimming example at the end.
I watched quite a few videos prior to yours and none of them makes sense until I come across this. Thank you!
This is a goldmine really!.. I hope you keep uploading
The best explanation of linkedlist I've found on youtube! Thank you!!!
👍👍☺️👍
Man you killed it in this tutorial AT 2AM IST I learnt Linked List going forward i'll complete this playlist Thanks for your contribution mate
I wish you all th best buddy ☺️👍
I came across this series just trying to touch up on my data structures. You do a phenomenal job going into detail at a human level where anyone can understand. Thank you sir!
Thanks for your kind words Drew.
one of the best tutorials i have ever come across !
👍😊
27:00 that's the funniest thing i ever heard I love it
LMFAO
I feel like i am attending best lectures of my life.
Smith I am glad you liked it
Out of all of the tutorials I've watched. This is undoubtably the best. Got you a new sub and a thumbs up! Thank you so much!
Highly recommended. Point to point neat and clean explanation
😊👍🙏
Excellent tutorial, highly recommended
Was following a course on coursera on same topic, but you are much better in creating that 'wow' enlightenment moment. Big thanks!
Super true
Best part of the channel is ,there is no ads 🤗
Great..! I have 7yr of experience. But still i am learning lot of new things from your side. This is what i was looking long time. Thank you so mush..!
Best help I have gotten regarding data structures. VERY CLEAR INSTRUCTIONS!!! Ugh I love you
Glad you liked it Michael 👍😊
How can someone teach all this with so much explanation and patience,
You rockz
😊👍
i appreciate you walking us through, AND including an exercise.
Thank You for the amazing insights for all the topics you have covered in this playlist. Thanks a lot! Highly appreciate your efforts.
👍🙂
best tuturials i have found so far, keep the good work man we all support your works. peace!!
I am happy this was helpful to you.
Such a beautiful Course For Interview Prep, Please Upload More!!
I am happy this was helpful to you.
Great video; I am preparing for an interview, and I am highly engaged with your tutorials, very easy to understand and follow, and I understood immediatelly how to do the first exercise, will be doing the second one soon as well. Thanks a lot!
Sava I wish you all the best for your interview
this is the most useful 28 minutes I spent today!
Thank you so much for explaining the Linkedlist concept in a simple way now I am able to write a linked list program in python
You explained it very well. Thank You. Also if possible, please create a new playlist where you put some good exercise questions and coding challanges on Data Structures and Algorithms to prepare for coding rounds in placements.
Excellent Explanation on all the features of linked list !❤!
Best explanation and proper way to make understand linked list .....❤️❤️
But for beginners , at first they have to know how linkedlist works but for the students who have some basic ideas about linkedlist ,can understand this
You are the best.
Explained such complex topics in an easy way 👌👌👌
Thanks a ton
I'm just loving this tutorial playlist. Thank you Code Basics!
you helped me so much for my coding interview. thank you!!
"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.
hey thanks much for pointing it out. I am not a native english speaker and I still make mistakes. I just watched some videos on taste vs test pronunciation and I think now I can pronounce them better.
@@codebasics sir so sweet of you...I feel bad for saying this now..my apologies!
def insert_after_value(self, value, data):
itr = self.head
while itr:
if itr.data == value:
node = Node(data, itr.next)
itr.next = node
break
itr = itr.next
else:
raise Exception("No value like that in this linked list")
def remove_by_value(self,value):
itr = self.head
count = 0
while itr:
if itr.data == value:
break
count += 1
itr = itr.next
ll.remove_at(count)
this works too sir!
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
I was coding along until at some point it got complex, so I decided to watch the whole thing first..but I dosed while watching..then for some reason I got up towards the end and heard @codebasics say...if you won't practice..forget it, you are wasting your time.. ouch, now I will have to start the video again **slapping my face**
Love the way you teach and make things easy to understand.
I am happy this was helpful to you.
Best tutorial I have come across. Enjoying it and revisiting the DS to enhance my skill. Loving it.
Glad it helped!
Thank you so much for your efforts you've put in teaching us DS in simple way...Really appreciate your way of teaching...Have tried something from my side too so sharing the code for functions given for assignment...
```
def insert_after_value(self, data_after, data_to_insert):
#check for first occurence of data_after and insert the value after it
head = self.head
pos = 0
isValExist = False
while head:
if head.data == data_after:
if pos == self.get_length():
self.insert_at_end(data_to_insert)
else:
self.insert_at(pos+1, data_to_insert)
isValExist = True
break
head = head.nextNode
pos += 1
if not isValExist:
raise Exception(str(data_after)+" Value doesn't exist in LinkedList")
def remove_by_value(self, value):
head = self.head
pos = 0
isValExist = False
while head:
if head.data == value:
if pos
This was really great. I also learned a lot more when I did the exercises at the end on my own. Thank you!
excellent tutorial. The exercises at the end are great for re-enforcement of what is taught and application of the knowledge to take it one step forward. Great work. Thanks a lot.
Glad it was helpful!
great video, thanks a lot. However I have couple of minor comments: 1) it was good to mention that python deque is already implemented all these methods and more. 2) in the insert_at method, you should have check the index for being at the end, to use the insert_at_end instead of looping through all elements in the list.
Hey, nice tutorial thank you!
I went for a recursive approach in implementing the linked list insert / delete methods.
I also had a Class Variable to keep the total count of index it will increase by 1 when any insert is done while decrement by 1 when a deletion takes place, so I override __len__ method in Python and used that to give it a more generic list type vibes same for printing the list used __str__.
I am currently trying to implement an additional argument tail inside, that will keep track of the last node, so so I don’t have to traverse to the end to insert making the time complexity for inserting / deletion at the end O(1)!!
I also implemented other default list methods like: count, reverse, sort!!
A great practise.
It's interesting to learn from such a great trainer.
I'd like to point out one update to the program: We should not be using self.get_length() while inserting or removing an element. That call results in O(n) even to insert or remove at the beginning.
Please correct me if I'm wrong.
I thought the same and I implemented this:
def remove_at(self, index):
if not self.head:
return
if index == 0:
self.head = self.head.next
return
node = self.head
_index = 0
while node:
if _index + 1 == index:
node.next = node.next.next
return
if not node.next:
return
node = node.next
_index+=1
You need to verify the index though, no? If the index is longer than the length of the list, then you get an error. In any case, the time stays O(n).
@@sava-lakicevic Yes, we can think in the algorithm order in the worst and best case. If we use the get_length method you will always have an O(n), but if you don't use it you can have a O(1) in the best scenario which is removing at the beginning.
I don't think that you need to verify the index in the code that I wrote, because if index > len(linked_list) you will return null because you will exit the while loop before reaching the condition _index+1 == index
@@sava-lakicevic In those (out of bound) cases it will be O(n).
Amazing explanation and analysis of LinkedList, new subscriber for sure!
well organized and explained the concept hands on! kudos.
Big brother you are angel for us for all these courses
Very great.....you just dont want to teach but also make the students learn through the exercise🤩
Should have come to this tutorial First! All the topics are here! :-)
Majority of the comments are appreciating the class , so i think problem is with me😅 , even though i hav completed basics of python , still i did't understand the coding part class that u hav given in this video. Is i am not intelligent enough to understand this ?
No matters , how hard it is ...
No matters , how many times i failed..
i will try it again....😡
Even me too😂
@@akki2016 yeah even though i understand the basic concept of linked list but when its comes to actual code i can only understand 70% of this video
Sir, your conceptualization and teaching style are superb, and you present the material very effectively. However, I am facing difficulty understanding the coding part. Could you please consider providing more detailed explanations or dedicate future videos to thoroughly explain the coding aspects? This would greatly enhance my learning experience.
Thank you.
Best tutorial on linked list oat.
Glad you enjoyed it
Brilliant. Thank you! 🤓 👍
I was trying to understand it completely and I got something that had completed my wish. Thank you soooo much. ♥♥♥
Wonderful!
you know a good way of teaching. thank you!
Thank you man, Now I'm clear with this concept
I might be incorrect but i have a doubt.
If there is already an element in the linked list and you will call insert_at_beginning method there is no link between the previous element and the new element because you are not linking, still it is printing because you are storing all the inserted elements in llstr.
This will create a link between previous and new element temp=self.head self.head=Node self.head.next=temp in the insert_at_beginning method.
@codebasics
Content is too good. Interested to see more advance algorithm videos and space complexity too. Thank you so much.
moreover it is very less time taken.
Sure
I will add more content in this series and also algorithms
this is a great video i have ever learned about linked list . Thank sir
Excellent video Dhaval thanks a lot
Thank you very much for your work!
So niceeeeeee!! Really helpfull. Thanks for sharing
Instead of traversing through the entire list to get size of the list. You can define a variable in the constructor function eg: self.counter, so whenever you add or delete a node just update the counter. And you can get the length of list in O(1) time complexity.
What a great explanation. Thanks a lot!
these are really clear helpful examples
I think along with link list my Oops confusion is clear. Thank you.
Thank you sir for this series, especially doing this in Python it was really hard to find DS and Algo implemented in Python.
Yup I know. That's why I selected python
@@codebasics but didn't complete all the data structures 😏
Lol, the virus threat XD. Thanks for the demo, learned a lot.
👍🤗🤗
The video is so good! Thanks for the effort
"Best way to learn something is by teaching it. "
"One can't teach a subject which he don't understand well."
Now the thing is you are amazing. And love from Bangladesh.
Preparing for interviews pray for me.
You are the man. Thanks for your videos!
Glad you like them!
Thank you very much your step by step explaination really helps
I am "tasting" this method. Jokes apart, brilliant work. Thumbs up.
I am happy this was helpful to you.
Nice explaination sir🔥
the way u explained is superb
Excellent explanation
What a lecture!!!! Thanks !!! 🏆🏆🏆🏆
Glad you liked it!
@7:56 , Insert element in the middle, for linked list isn't is supposed to be O(1) instead of O(n) ?
An excellent remark... Actually, the insertion itself takes 1 unit ( O(1) ) but finding the place where to insert needs iteration, and here comes the O(n).
Here he assumes u r not yet at the insertion place and you are going to look where to insert. But u r right.. insertion ONLY is O(1).
Thanks for your great explanation!!!