Data Structures Using C++: Inserting a Node into a Linked List (Sorted Linked List)
Concepts:
Logical representation of inserting a node into a linked list to maintain a sorted list
Three Cases are examined:
Inserting a node into an empty linked list
Inserting a node into a list with at least one node and we want to insert the new node at the head.
Inserting a node into a list with at least one node and we want to insert the new node somewhere other than the head.
Usage of a current pointer.
Usage of a trail or previous pointer.
How pointers must be updated to perform an insert.
Пікірлер: 44
9 years later, and you just got me out of this unending runtime errors Thanks a lot!
The best way to learn linked is through drawing demonstrations as you did in this videos, I’m glad I find this video. 👍
Professors in universities should go through process like this to provide scenario for students. Thank you so much. Your video saved my degree.
Exceptional tutorial! I cant wait to watch the rest of your videos!
Thank you very very much for this set of videos with kind explanations! May God bless you!
Awesome! well explained, that trailing pointer made my day
Nice tutorial! thanks. cleared out what I was failing to understand since long! :)
Thanks a lot for your time. Keep the good tutorials.
Thank you. You are totally right about visualizing it.
thanks for this tutorial, it was exactly what I needed to know.
Finallyyyy a tutorial in English!! And not Indian.
This is very helpful. Thx for making this awesome video
thank you for the video! am slowly understanding it. thank you again
Thank you! Now it's clear to me :D
Thanks for sharing this, really helpful and well explained content.
And also, there's no need trail node to add new node after second node. The code below works properly: Contact* tp = head->next; newOne->next = tp->next; tp->next = newOne;
you are amazing thank you so much for your work
"head" is a pointer that holds the address of the "Bill" node at 4:47, so assigning newNode->next (next is also a pointer) to "head" is assigning it to point to "Bill". We have no other mechanism in this example to set newNode-next to point to the "Bill" node other than the "head" pointer. Let me know if I misunderstood your question.
Thank you!
Great tutorial
That just helped me a lotttttt!
great explanation
Thank you very much
very helpfull...
I messed up a bit there... I wanted C to go between A and B so bad for my example that I reordered the alphabet. Thanks for catching my mistake.
thanks for not making this thing complex
Thanks alot
is it the same logic with a double linked list ? nullptr or head or somewhere else ?
Would you even need a "trailing" pointer if you were inserting into a Doubly Linked list? You would have the pointer back to Bob from Tom's previous pointer, right?
how to find out where the node is to be inserted by just using names that are string types??
What is the time complexity of inserting into this data structure?
Is there something wrong at "Add Node After Head" stuff? Because, you have added the new node after second node. - List before addition: April (Head) -> Bob -> Tom - List after addition: April (Head) -> Bob -> Sally -> Tom. Is the list suppose to be (April -> Sally -> Bob -> Tom) ?
lmao came back to this video cause i got confused again... god this pointer business is rough... will get it tho hopefully soon haha
ooh my bad guess I ws getting tired .... confusing Bill the string and head the pointer ... thanx again
gr8 tutorial... @ 04.47 shld it not point to Bill?instead of Head
Where is the code
What about at end of list?
@4Y0P
8 жыл бұрын
+possibility28able It being the end of a list doesn't make it an exception
newNode-->next=bill; head=newNode; shouldn't it be like this? 4:44
is it sheldon speaking ? ??
Length of video is 12:34 hehe
9:16 It's ABCDE... not ACBDE...
no thanks jesus