After switching from so many tutorials on TH-cam regarding DSA. I’ve come across the best channel. You’re explaining very well. You’re an excellent teacher & by far the best. Keep it up.
I have been struggling with DSA's concepts. But your videos are crystal clear that now I could able to handle DSA's. Thank you so much for all your efforts
After almost an hour of having multiple breakdowns trying to understand this shit by watching multiple vids across yt, I found this video and the programming part totally makes sense FINALLY. Thank you !
I love this channel. I have searched for several videos on DSA but this was the best. It felt like you opened my head and paste all the knowledge in there. Thanks for sharing your knowledge on DSA. I look forward to more interesting videos. God bless you.
Besides you i did watch other videos relating to linked list and python, yours by far was the most helpful due to your expansive explanations. Really appreciate the effort!
hi, is it necessary that while running a program i am getting error at LL1.print_LL. and also can someone say if i have to do everything in order like first create node then linkedlist then traverse,add and then remove?
Hi mam Thank you for the video. I have one doubt in the Display link list we write the condition as While n is not None but in inserting the last node we use while n.ref is not None. Y so difference as both accessing same element.. Please clarify why n.ref in inserting..
@@AmulsAcademy singly linked list mam.. Basically everytime get confused.. When it comes to assigning a variable like.. Self. head=new node or new node=self.head...?
First you need to learn working of linked list watch all the videos, learn what happens when we perform operation on linked list then you will understand how to write programs :)
when you take self.head.ref we are referring to the link stored in the first node, in the program we want to traverse through every node to reach last node so for that first we need to take first node as n.
Please help 🙏🙏🙏 If we call add_last() .... Self.head will go to last node right? If we call add_begin() now... Then new element will add at third position from end right? But How is it coming exactly how we want please help?😕😕
Hey i have tried this code but, I am getting an error *add_beggining(30)* then *add_beggining(40)* then *add_end(11)* . when I print the Linked list it is showing me _from 30 --> 11 not from 40--> 30 --> 11_ . this is happening in the code *add_end()* when you put at the end. *n.ref = new_node* here, *self.head.data* is still *30* and *_self.head.next_**_ is pointing to my new node_* after this code when I use the * print code* it is starting from node *_self.head.data_**_ 30_* . please help.
class Node: """Class for node creation""" def __init__(self, data): self.data = data self.next = None class LL: """ Class which links all the nodes together""" def __init__(self): self.head = None def traverse(self): """ Traversing through the linked list""" if self.head is None: print("linkedlist is empty") else: while self.head is not None: print(self.head.data, "-->", end=" ") # we are passing the self.head with self.next self.head = self.head.next def add_begining(self, data): """ adding the node to the beginning of the Linked list""" # get the data which is to be added to the beginning of the linked list my_node = Node(data) # Changing the my node reference to the new node # self.data = 30 self.next = None my_node.next = self.head # point the current head to the new node self.head = my_node def add_end(self, data): """ Adding node to the end of the linked list""" self.head = self.head my_node = Node(data) if self.head is None: self.head = my_node while self.head.next is not None: self.head = self.head.next self.head.next = my_node def add_between(self, data, x): my_node = Node(data) while self.head is not None: if x == self.head.data: break self.head = self.head.next if self.head is None: print("The item is not present in the list") my_node.next = self.head.next self.head.next = my_node def add_before(self, data, x): if self.head is None: print("Linked List is empty!") return if self.head.data == x: new_node = Node(data) new_node.ref = self.head self.head = new_node return n = self.head while n.ref is not None: if n.ref.data == x: break n = n.ref if n.ref is None: print("Node is not found!") else: new_node = Node(data) new_node.ref = n.ref n.ref = new_node # node1 = Node(10) linkedlist = LL() linkedlist.add_begining(30) linkedlist.add_begining(40) linkedlist.add_begining(50) linkedlist.add_begining(60) linkedlist.add_between(45, 50) # linkedlist.add_end(11) linkedlist.traverse()
In your program add_between function will add node after mentioned node right ? in that function take n =self.head also you missed else block In add_end Also you missed else block :)
Hi Thank you for the video. I have one doubt in the Display link list we write the condition as While n is not None but in inserting the last node we use while n.ref is not None. Y so difference as both accessing same element.. Please clarify
In add_end() function to add element in the end of LL, the line n.ref=newnode, it is throwing me an error AttributeError: 'NoneType' object has no attribute 'ref' ,,,,,,,,,,, can you pls help
for add_end() function after using n = self.head while n.ref is not None: n= n.ref n.ref = new_node In the above code, self.head is updated nowhere; however, after execution of the last line, s self.head is updated automatically. How? @Amulya's Academy
For keeping it short, let's assume we know that the linked list is not empty. So, let's review step by step: 1. Let's say n will be the head of the linked list. So it will be self.head. 2. We need to iterate through every node to reach the last node. We know that after the last node, which is n.ref, there should not be any value. 3. After we reach the last node, the next node will be the new node that we provided and it becomes the last node(tail) of the list.
You have made a mistake here we have to change the ref of the prev element from the last element to the ref of the new node that we added in the linked list
Hi guys I think it is mandatory to take n = self.head she said in one of the lesson that she doesn't want to take self.head again and again. But this is not true. We have to take a variable 'n' and we have to assign n = self.head
After switching from so many tutorials on TH-cam regarding DSA. I’ve come across the best channel. You’re explaining very well. You’re an excellent teacher & by far the best. Keep it up.
Thank you :)
@@AmulsAcademy really mam thank you for this wonderful explanation
I have been struggling with DSA's concepts. But your videos are crystal clear that now I could able to handle DSA's. Thank you so much for all your efforts
underrated video for understanding the concept of linked list in python.....very nice explanation
Thank you :)
After almost an hour of having multiple breakdowns trying to understand this shit by watching multiple vids across yt, I found this video and the programming part totally makes sense FINALLY. Thank you !
I love this channel. I have searched for several videos on DSA but this was the best. It felt like you opened my head and paste all the knowledge in there. Thanks for sharing your knowledge on DSA. I look forward to more interesting videos. God bless you.
If i count my all words these will not enough for u...... Excellent work really bravo ❣️.... Fully understandable
Thank you 😊
your voice is really calm whgile explaining this complex topic. Very smooth explanation. Thanks Amulya's Academy
The best Explaination of linkedlist program that I have ever seen so far. Thank for this video
i have my placements next semester so far every topic i saw you have explined crystal clearly
Mam please keep going really awesome explanation and you deserves one of the best teacher i have seen so far👍👍👍
Thank you :)
Most underrated youtuber
Mam you worth Million Subs.....Thank you for your every little detail.
Thank you very much. You explained it explicitly and I've come to understand it very well. This is an excellent tutorial!
Glad it was helpful! :)
omg even i tried various sources and couldn't find anything this good you are so beautiful i love you sooo much thank you........
Besides you i did watch other videos relating to linked list and python, yours by far was the most helpful due to your expansive explanations. Really appreciate the effort!
You explained really well, I understood it very well, thank you so much mam for providing us with this easy to understand explaination.
Thank you :)
your way of xplanation was really osm,tnq so much...
Most welcome :)
Thank you very much! This explanation solved problem in my program!
Excellent teaching quality...🙏
Thank you 😊
Really helpful these classes for us mam..
Awesomeness Overload!
nice video I am really amazed and your teaching way is to good thank you
Thank you so much for this tutorial. you do a very good job
Mam you are the best 🥰
Excellent work ⭐⭐⭐⭐
Thank you for the video mam.. With Very good explanation..
My Pleasure :)
Thankyou for explaining in details
too good and easy to understand
You explained it very well. Thank you, ma'am! :))
very nice ma'am🙂
Thanku so much your videos are amazing 💕
thanks a lot maam!loved the explanation!!
Most welcome!
Thank you so much❤❤
hi, is it necessary that while running a program i am getting error at LL1.print_LL.
and also can someone say if i have to do everything in order like first create node then linkedlist then traverse,add and then remove?
very help full thank u very much!
Hi mam Thank you for the video. I have one doubt in the Display link list we write the condition as While n is not None but in inserting the last node we use while n.ref is not None. Y so difference as both accessing same element.. Please clarify why n.ref in inserting..
Mam i get confused what to code.. Self.head=new node...or... new node=self.head....can u explain this?
You are talking about singly linked list or doubly linked list ?
@@AmulsAcademy singly linked list mam.. Basically everytime get confused.. When it comes to assigning a variable like.. Self. head=new node or new node=self.head...?
First you need to learn working of linked list watch all the videos, learn what happens when we perform operation on linked list then you will understand how to write programs :)
Mam are there any plans for you to teach machine learning using python , I would really love to study it the way you teach python.
Following
I don't know :)
Hi, one doubt. If I used self.head.ref instead of n.ref. The code is not working. Why is that?
when you take self.head.ref we are referring to the link stored in the first node, in the program we want to traverse through every node to reach last node so for that first we need to take first node as n.
mam, i had fear of DSA, now i feel like very easy.
thank you... very much
Pleasure :)
Please help 🙏🙏🙏
If we call add_last() .... Self.head will go to last node right?
If we call add_begin() now... Then new element will add at third position from end right?
But How is it coming exactly how we want please help?😕😕
Why this self.head is acting like global?
Hey i have tried this code but, I am getting an error *add_beggining(30)* then *add_beggining(40)* then *add_end(11)* . when I print the Linked list it is showing me _from 30 --> 11 not from 40--> 30 --> 11_ . this is happening in the code *add_end()* when you put at the end. *n.ref = new_node* here, *self.head.data* is still *30* and *_self.head.next_**_ is pointing to my new node_* after this code when I use the * print code* it is starting from node *_self.head.data_**_ 30_* . please help.
Hey can you give me the code , I will check what is wrong in that 😊
@@AmulsAcademy can u sent me your email id
class Node:
"""Class for node creation"""
def __init__(self, data):
self.data = data
self.next = None
class LL:
""" Class which links all the nodes together"""
def __init__(self):
self.head = None
def traverse(self):
""" Traversing through the linked list"""
if self.head is None:
print("linkedlist is empty")
else:
while self.head is not None:
print(self.head.data, "-->", end=" ")
# we are passing the self.head with self.next
self.head = self.head.next
def add_begining(self, data):
""" adding the node to the beginning of the Linked list"""
# get the data which is to be added to the beginning of the linked list
my_node = Node(data)
# Changing the my node reference to the new node
# self.data = 30 self.next = None
my_node.next = self.head
# point the current head to the new node
self.head = my_node
def add_end(self, data):
""" Adding node to the end of the linked list"""
self.head = self.head
my_node = Node(data)
if self.head is None:
self.head = my_node
while self.head.next is not None:
self.head = self.head.next
self.head.next = my_node
def add_between(self, data, x):
my_node = Node(data)
while self.head is not None:
if x == self.head.data:
break
self.head = self.head.next
if self.head is None:
print("The item is not present in the list")
my_node.next = self.head.next
self.head.next = my_node
def add_before(self, data, x):
if self.head is None:
print("Linked List is empty!")
return
if self.head.data == x:
new_node = Node(data)
new_node.ref = self.head
self.head = new_node
return
n = self.head
while n.ref is not None:
if n.ref.data == x:
break
n = n.ref
if n.ref is None:
print("Node is not found!")
else:
new_node = Node(data)
new_node.ref = n.ref
n.ref = new_node
# node1 = Node(10)
linkedlist = LL()
linkedlist.add_begining(30)
linkedlist.add_begining(40)
linkedlist.add_begining(50)
linkedlist.add_begining(60)
linkedlist.add_between(45, 50)
# linkedlist.add_end(11)
linkedlist.traverse()
In your program add_between function will add node after mentioned node right ?
in that function
take n =self.head
also you missed else block
In add_end Also you missed else block :)
madam,
after while loop "n" is "None"?
LL1 is not a list. I am i correct. if so why the term coming , beging , end and between
What is the time complexity of inserting node at the end
Hi Thank you for the video. I have one doubt in the Display link list we write the condition as While n is not None but in inserting the last node we use while n.ref is not None. Y so difference as both accessing same element.. Please clarify
I exactly have the same question, could someone please clarify? Thanks.
Because last element is tail which donot have refrence so we use..in that way
Am basically your traversing here as well to move to the last element then y can't we call the above class and it's functions
Try it :)
In add_end() function to add element in the end of LL, the line n.ref=newnode, it is throwing me an error
AttributeError: 'NoneType' object has no attribute 'ref' ,,,,,,,,,,, can you pls help
same error
Why this self.head is acting like global?
Please provide cheat sheet when your explaining in that notes
Shouldn't there be a new_node.next = None at the end of add_end() method since a reference isn't being assigned to the last node?
when you created new node by default reference is taken as None, so need to write that again :)
Thank you bro
mam, why 20 is added first? and why don't 10 is added in first???? i am still confused
for add_end() function after using
n = self.head
while n.ref is not None:
n= n.ref
n.ref = new_node
In the above code, self.head is updated nowhere; however, after execution of the last line, s self.head is updated automatically. How? @Amulya's Academy
For keeping it short, let's assume we know that the linked list is not empty. So, let's review step by step:
1. Let's say n will be the head of the linked list. So it will be self.head.
2. We need to iterate through every node to reach the last node. We know that after the last node, which is n.ref, there should not be any value.
3. After we reach the last node, the next node will be the new node that we provided and it becomes the last node(tail) of the list.
The way she says "linked list" is so cute
I can't understand why u potted while n is not none to adding new node in the last list
i think in print_ll while n is not correct it is n.ref
Why this self.head is acting like global? I m confused
You have made a mistake here we have to change the ref of the prev element from the last element to the ref of the new node that we added in the linked list
Why n = self.head? explain plz
Just a variable, instead of writing self.head.ref we can write it in short n.ref 😊
i think while loop have some correction:
while n is not None: instead of this , they wrote (while n.ref is not None: )
Why this self.head is acting like global?
👍
Thank you :)
Hi guys I think it is mandatory to take n = self.head
she said in one of the lesson that she doesn't want to take self.head again and again.
But this is not true. We have to take a variable 'n' and we have to assign n = self.head
someone post codes here please
how old are you maybe 20
....
Content is good but this chuk irritates me
Sorry😔
Thank You So Much
Pleasure 😊
Thank you so much