Data Structures Using C++: Inserting a Node into a Linked List (Sorted Linked List)

preview_player
Показать описание
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.
Рекомендации по теме
Комментарии
Автор

9 years later, and you just got me out of this unending runtime errors
Thanks a lot!

laithalajarmah
Автор

The best way to learn linked is through drawing demonstrations as you did in this videos, I’m glad I find this video. 👍

elwafi
Автор

Professors in universities should go through process like this to provide scenario for students. Thank you so much. Your video saved my degree.

andrewnguyen
Автор

Exceptional tutorial! I cant wait to watch the rest of your videos!

pedrowski
Автор

Thank you. You are totally right about visualizing it.

MrDubs
Автор

Nice tutorial! thanks. cleared out what I was failing to understand since long! :)

unknownindian
Автор

Thanks a lot for your time. Keep the good tutorials.

mohdadyg
Автор

Thank you very very much for this set of videos with kind explanations! May God bless you!

jaehuhn
Автор

Awesome! well explained, that trailing pointer made my day

felixkimutai
Автор

you are amazing thank you so much for your work

dark.violin
Автор

Thanks for sharing this, really helpful and well explained content.

fzane
Автор

thanks for this tutorial, it was exactly what I needed to know.

tarabolical
Автор

thank you for the video! am slowly understanding it. thank you again

abugslife
Автор

Finallyyyy a tutorial in English!! And not Indian.

ronniesaieed
Автор

This is very helpful. Thx for making this awesome video

mosesmccabe
Автор

"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.

ReelLearning
Автор

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;

AliEmreCakmakoglu
Автор

Thank you! Now it's clear to me :D

AnthonyInSanDiego
Автор

how to find out where the node is to be inserted by just using names that are string types??

berlinjames
Автор

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) ?

AliEmreCakmakoglu