How to insert a new node in a linked list in C++? (at the front, at the end, after a given node)

  Рет қаралды 139,133

CodeBeauty

CodeBeauty

Күн бұрын

In this video I'll explain three different ways to insert a new node into a linked list:
- Insert a node at the front of a linked list
- Insert a node at the end of a linked list
- Insert a node after a given node
You can find the simple linked list from the start of the video in the pinned comment.
If you want detailed explanation, watch the video below.
Lists (real app example) - • C++ List (Real example...
Introduction to Linked Lists - • Introduction to Linked...
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.
Download Visual Assist here: bit.ly/WT-CB
I use it to enhance the performance, features, and support for C, C#, and C++ development in Visual Studio.
Download Ultra Edit here: bit.ly/UE-CB
It is a powerful, secure text editor designed specifically for programmers.
☕ If you've found my content helpful and would like to support me, you now have the option to buy me a coffee or a cookie! It's a small gesture of gratitude that means a lot to me and helps me keep creating free educational videos for you. Use the link to make a contribution: bit.ly/CodeBeauty_BuyMeACoffee
However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇
Contents:
00:00 - Intro and explaining initial code for simple linked list
03:59 - Insert a node at the front of a linked list
11:53- Insert a node at the end of a linked list
22:37 - Insert a node after a given node
You can find the simple linked list from the start of the video in the pinned comment.
Add me on:
Instagram 📸 - / truecodebeauty
Twitter 🐦- / truecodebeauty

Пікірлер: 337
@CodeBeauty
@CodeBeauty 3 жыл бұрын
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️ C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook 🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/ Experience the power of practical learning, gain career-ready skills, and start building real applications! This is a step-by-step course designed to take you from beginner to expert in no time! 💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10). Use it quickly, because it will be available for a limited time. #include using namespace std; class Node { public: int Value; Node* Next; }; void printList(Node* n) { while (n!=NULL) { cout Value Next; } } int main() { Node* head = new Node(); Node* second = new Node(); Node* third = new Node(); head->Value = 1; head->Next = second; second->Value = 2; second->Next = third; third->Value = 3; third->Next = NULL; printList(head); system("pause>0"); }
@alen91
@alen91 3 жыл бұрын
di si? pozz iz tz---kakvo je vrijeme u Mostaru?
@ashrafmugalli2179
@ashrafmugalli2179 3 жыл бұрын
Thanks for your videos you’re an amazing teacher. I’m paying for university but I learn better from your videos
@GenjaOrigins
@GenjaOrigins 3 жыл бұрын
Why not all the code at the end.
@aspabhi31
@aspabhi31 2 жыл бұрын
When we are inserting a node after specific node, why are we not passing address of previous node in the function insertAfter?
@dileepbokka5525
@dileepbokka5525 2 жыл бұрын
Share over all code
@mdmobarokrubel2635
@mdmobarokrubel2635 3 жыл бұрын
Please please please cover all the data structure and algorithm (DSA) topics. Loved all your C++ videos but if you cover DSA topics as well, hundreds and thousands will find help.
@eng6070
@eng6070 2 жыл бұрын
+10000000
@mariacunha8508
@mariacunha8508 Жыл бұрын
pleeease!
@den15_zzz
@den15_zzz Жыл бұрын
Upppp!
@sarwat3552
@sarwat3552 2 жыл бұрын
You can explain very thoroughly . Hands down this is by far the best linked list video I've ever come across KZbin. Please upload more such content, you have a great skill of expressing your ideas easily to people, best wishes
@SavageScientist
@SavageScientist 3 жыл бұрын
i love how you pasted the source code right in the comment now thats accessibility
@fly4me2night
@fly4me2night 3 жыл бұрын
Lol Raw is the new thing
@aspabhi31
@aspabhi31 2 жыл бұрын
When we are inserting a node after specific node, why are we not passing address of previous node in the function insertAfter?
@SavageScientist
@SavageScientist 2 жыл бұрын
@@fly4me2night its Savage
@doublej118jc
@doublej118jc 2 жыл бұрын
I've watched a few of your videos and In one of them you mentioned your life-long dream is to be a teacher. You should definitely pursue that dream you're a VERY good teacher!
@beegameplay2.082
@beegameplay2.082 3 жыл бұрын
I liked your teaching style you are making your all viewers as a good coder. You clear all concepts easily speaking in english but others not and thats very helpful for all kinds of viewers. Love from Pakistan 🇵🇰❤️❤️
@minenhlenduduzonkabinde
@minenhlenduduzonkabinde Жыл бұрын
You are the best Code teacher I've come across Miss Saldina. Teachers like you are what we need. Taking us step by step through concepts with very detailed explanations and implementations. You are just outstanding. Truly impressive work.🥳. You are appreciated all the way from South Africa.
@CodeBeauty
@CodeBeauty Жыл бұрын
🥰❤️
@dwivedys
@dwivedys Ай бұрын
These pointers -- are treacherous -- there’s no other way of saying this …thank you for your lovely explanation as always…
@CodeBeauty
@CodeBeauty Ай бұрын
You're welcome 🥰
@yunxinglu4020
@yunxinglu4020 3 жыл бұрын
Love your video! I spent the whole day yesterday and tried to understand what the linked list is. All other videos was confusing but now with your help and I totally get it! Thank you so much!!! Keep it up for the excellent work!
@maxdemendieta1426
@maxdemendieta1426 Жыл бұрын
You’re a life saver, your videos are so clear and easy to understand, thank you so much for creating content like this
@djordjeivkovic9787
@djordjeivkovic9787 2 жыл бұрын
I spent one month learning this in my class and here everything is explained in just 30min... GOOD JOB !!!
@diabhattacharya3425
@diabhattacharya3425 10 ай бұрын
Great Work !The best teacher I've come across on yt so far!
@omeralsumeri5819
@omeralsumeri5819 2 жыл бұрын
Thank you so much, I love the way you teach and explain everything perfectly. I hope the best for you in all of your goals and pursuit of happiness.
@luisalamo2658
@luisalamo2658 Жыл бұрын
Your videos are a refresher to me, I learned these concepts with Pascal a few year ago for the university and I forgot it. Thanks!
@lamprosgiannopoulos8489
@lamprosgiannopoulos8489 3 жыл бұрын
Just in time, i just finished the previous video and boom... another one. You're a speedrunner! 😜
@piiaall
@piiaall 2 жыл бұрын
Your explanation skill is great. Loved how you didn't start from a very complex way to implement a linked list✨️
@yashparasariya530
@yashparasariya530 3 жыл бұрын
This video made linked list far more easier to understand. Great work🔥
@Reem-du7sd
@Reem-du7sd 2 жыл бұрын
I never comment on KZbin videos but omg YOU ARE A LIFE SAVER! I've always found difficulty in coding, but thanks to your videos I am slowly gaining confidence. Forever grateful for all the knowledge you are sharing with us!❤
@eduardogomez5345
@eduardogomez5345 2 жыл бұрын
Your explanations are the best, this is what I was looking for all this time
@abhaytomar6288
@abhaytomar6288 2 жыл бұрын
Amazing explanation, you have made this very simple and easy to understand. I was facing issue in understanding the insertion operation in linked list. Thanks for this.
@jonathanmascarenhas185
@jonathanmascarenhas185 2 жыл бұрын
You’re an amazing teacher. Thank you for your content I really appreciate it.
@AnupamShaw
@AnupamShaw 3 жыл бұрын
I wish I had known about this channel during my high school. Data Structures were something that made me get frustrated and unlinked a lot of my brain cells. But it's never too late to learn. Thanks for this video. 👌😊
@sairanjanpanda736
@sairanjanpanda736 Жыл бұрын
I was so confused about how to insert an node in the linked list but after watching this video I am not confused anymore. Your way of explanation is so good.
@mikaelasydney788
@mikaelasydney788 Жыл бұрын
im so happy that you existed! you help me alot through my coding journey honestly you are better than my professor
@supraocny
@supraocny 4 ай бұрын
Perfect explanation of inserting a node between two nodes. It took me what feels like forever to understand linked lists, but this helped a lot.
@divanbasson5545
@divanbasson5545 2 жыл бұрын
Wow you really explain these concepts well.
@shakshi9108
@shakshi9108 3 жыл бұрын
Your explanation is the simplest and best..thankyou for the good work
@bunman2353
@bunman2353 3 жыл бұрын
you just save my last assignment! Thank you!, you are such good teacher!
@saldanaswiz1291
@saldanaswiz1291 2 жыл бұрын
Beautiful explanation! Thank you so much!
@rishus7938
@rishus7938 3 жыл бұрын
Please keep going. Most people give up making Yt videos. Very articulate explanations. I watched a few of your videos 7-8 months back. The delivery and clarity has improved a lot. And happy women's day. 😎
@CyberSpark23
@CyberSpark23 2 жыл бұрын
Hey Saldina! your videos have really helped me through uni the last 2 days, would you please cover double and circle LL? and defintley some sorting algorithims, keep up the good work!
@francois8441
@francois8441 Жыл бұрын
This definitely helps me to understand the linked list. I searched a video on KZbin that is spoken in my mother language but all of them were much difficult than yours. In addition, they were too generalized from the beginning, but this point-by-point lecture makes me understand well.
@taayakin1108
@taayakin1108 Жыл бұрын
I absolutely love these videos! Learning Data Structures and Algorithm implementations in C++ (as well as becoming more fluent with the language). Will be watching much more, thanks for the awesome content, you're a great teacher :D
@CodeBeauty
@CodeBeauty Жыл бұрын
Welcome, I'm glad 😃😃
@prateekshukla6056
@prateekshukla6056 3 жыл бұрын
I found your explanation easiest. I am very happy with your teaching style.
@King-un8ui
@King-un8ui 3 жыл бұрын
I can't understand my professor at all, and your explanation is amazing. Thank you for this two linked list tutorials!
@CodeBeauty
@CodeBeauty 3 жыл бұрын
🤗🤗🧡
@aspabhi31
@aspabhi31 2 жыл бұрын
@@CodeBeauty When we are inserting a node after specific node, why are we not passing address of previous node in the function insertAfter?
@sieghart1931
@sieghart1931 2 жыл бұрын
@@aspabhi31 you will only need pointer to pointer when you want to change the value of the pointer, like in the insertAtTheFront(), you will make the *head to point to the newNode.
@programmingwithjackchew903
@programmingwithjackchew903 2 жыл бұрын
@@sieghart1931 isn't should be change the address of pointer?
@shashimohansingh140
@shashimohansingh140 2 жыл бұрын
Thanks Saldina, You made it very easy for us to understand these topics. Once again big thanks.
@Zita098765
@Zita098765 2 жыл бұрын
You're currently saving me for my head assignment (a family tree). Thank you!
@royalty-024
@royalty-024 10 ай бұрын
You have been so helpful. You explain in such a simple clear way and so straight to the point . I love your videos.❤♥💗💓
@joebosah2727
@joebosah2727 2 жыл бұрын
This is a excellent presentation in simple understandable English. The topic was nailed. Thank you
@fayehill1225
@fayehill1225 2 жыл бұрын
Thanks a lot. One of the best tutorials I've watched!
@hicarodanrlley149
@hicarodanrlley149 3 жыл бұрын
I really appreciate your course about OOP. Thank you so much for that masterpiece work
@aspabhi31
@aspabhi31 2 жыл бұрын
When we are inserting a node after specific node, why are we not passing address of previous node in the function insertAfter?
@hicarodanrlley149
@hicarodanrlley149 2 жыл бұрын
@@aspabhi31 We just have the head node address, we have to loop through the linked list until the previous node. That's why we have O(N) for inserting after because we need to loop until the previous node and after that we insert our node
@daniele9017
@daniele9017 3 жыл бұрын
Best teacher ever.
@exton69
@exton69 2 жыл бұрын
I don't write comments much but i am writing this to thank you for being my savior in my hard times such as my exams lol, you are lliterally the only coder on youtube who i have found to be so descriptive. Thank you for being on youtube .
@ehsanulhaqueraiyan8681
@ehsanulhaqueraiyan8681 Жыл бұрын
your teaching technique is great!
@raghavchawla1658
@raghavchawla1658 Жыл бұрын
best linked list video tutorial i came across
@maurobaldini4582
@maurobaldini4582 Жыл бұрын
Thanks! Really clear and easy to follow 😃
@xfactorbangs5821
@xfactorbangs5821 2 жыл бұрын
Thanks for the valuable content.
@hassanjaved2435
@hassanjaved2435 2 жыл бұрын
Great Explanation
@amanpratapsingh6056
@amanpratapsingh6056 3 жыл бұрын
Ma'am keep posting videos on Data Structures & Algorithms . Really love your way of teaching. Keep growing ma'am ❤❤❤❤❤
@PascalHFRIES
@PascalHFRIES 2 жыл бұрын
Bravo for this very educational tutorial!
@mrtechsavvy8835
@mrtechsavvy8835 Жыл бұрын
best explanation of linked lisgt ever seen on you tube
@peterkaram7929
@peterkaram7929 2 жыл бұрын
continue doing all sort of videos your saving lifes
@cashmoney12345
@cashmoney12345 Жыл бұрын
u explain things 10 times better tthan any professor or textbook has ever for me
@Bess_Gates
@Bess_Gates Жыл бұрын
your teaching style i really really perfect
@MrBoczald
@MrBoczald 3 жыл бұрын
Great work!! Thank you!
@jeromeswizz4917
@jeromeswizz4917 8 ай бұрын
You have done an exemplary job!!! .God bless. Lifesaver.
@TheYvib
@TheYvib Жыл бұрын
Thanks, that was very helpful!
@isaacmuwanga5707
@isaacmuwanga5707 3 жыл бұрын
I love your teaching style because it has made me to fall in love with C++ something I used to fear.
@luisalamo2658
@luisalamo2658 Жыл бұрын
I Know that feel bro
@yasubhaipk
@yasubhaipk Жыл бұрын
Explain in such way.. Oh my god... So niceeee.. thanks mam
@iVuDang
@iVuDang Жыл бұрын
great explanation, thank you! love the outline in comments before you started coding in detail
@informativeandlearning8876
@informativeandlearning8876 2 жыл бұрын
thank you for such a hard work
@AHMAD_GH0
@AHMAD_GH0 Жыл бұрын
You are the best! ❤❤ Thank you 🥰
@abdiqadirabdi940
@abdiqadirabdi940 Жыл бұрын
thank you a lot, it really help me for a full comprehension of the topic. Namaste
@patriciacarvalhodemorais5769
@patriciacarvalhodemorais5769 Жыл бұрын
I need to thank ou so much!! I'm on university and have to make a test about data structures in c++, but I had no knowledge of c++ before, only python and a little bit of c, so I first watched your full course video and now I am watching this one, you are amazing!! Also I'm brazilian and your english is absolutely perfect!
@mohammadhawa337
@mohammadhawa337 3 жыл бұрын
Thank you so much for this masterpiece work
@stephenelliott7071
@stephenelliott7071 Жыл бұрын
That's a very clear and excellent video on linked lists.
@NguyenucNam_
@NguyenucNam_ 2 жыл бұрын
Love!!! So easy to understand it😍😍
@BasitAli-uk6fj
@BasitAli-uk6fj Жыл бұрын
its very helpful video to every student whose want to learn DSA....i learn in just a 1 hours .....thanks allots from pakistan 👍....
@muckiSG
@muckiSG 2 жыл бұрын
Just a suggestion especially on data structures. It would be much easier or most peaple to have some graphics. Linked lists, binary trees and so on are hard to explain with just your hands. :-) Thanks for your good work!
@moularaoul643
@moularaoul643 3 жыл бұрын
Hi Great Lady! Thank you so much!!!
@abugslife2461
@abugslife2461 Жыл бұрын
Love this video!!! Thank you so much, very helpful!
@nasirhammi
@nasirhammi Ай бұрын
God bless you. Thank you so much for the very good explanation
@mohamedbenhassan936
@mohamedbenhassan936 2 жыл бұрын
thank you so much for your amazing explanation
@Kinsey_
@Kinsey_ 2 жыл бұрын
This video is super helpful and informative
@muhammadsaif5744
@muhammadsaif5744 Жыл бұрын
Most Underrated Channel ever
@zombiehellmonkeygaming1956
@zombiehellmonkeygaming1956 3 жыл бұрын
Great video thanks!
@hazz307
@hazz307 3 ай бұрын
THANK YOU SO MUCH!!!
@kannamsai9913
@kannamsai9913 2 жыл бұрын
Ma'am please cover all data structure and algorithm topics and also it would be very helpful if you give some standard practice questions on each topic, as homework and explain those practice questions in a new video.
@ktubesk
@ktubesk 3 жыл бұрын
remarkable piece of Code especially the detailed explanation line by line , thank you So much.
@CodeBeauty
@CodeBeauty 3 жыл бұрын
🤗🤗🥰
@funnyvideos-mv5ec
@funnyvideos-mv5ec Жыл бұрын
i just wanna say thank you u saved me
@MickyasTesfaye-ji5xx
@MickyasTesfaye-ji5xx 8 ай бұрын
thanks very much God Bless You
@mastermax4658
@mastermax4658 8 ай бұрын
You are the best in the KZbin💗
@anadhimitri4193
@anadhimitri4193 2 жыл бұрын
You are the best teacher ever. Period.
@CodeBeauty
@CodeBeauty 2 жыл бұрын
🥰🥰
@PureASM-ShellCoder
@PureASM-ShellCoder 3 жыл бұрын
Thanks a lot for explaining that so niceIy -I understood all of it ! 😊👍
@burntt999
@burntt999 2 жыл бұрын
lady. THANK you so much.. you helped me understand this and pass my tests. thank you tahnk you thank you thank you
@marcosoliveira8731
@marcosoliveira8731 3 жыл бұрын
7 here. Another great class! Thank you!
@atohagan3588
@atohagan3588 3 жыл бұрын
best c++ instructor I have come across
@CodeBeauty
@CodeBeauty 3 жыл бұрын
☺️🥰🥰
@Asterics.
@Asterics. 4 ай бұрын
I had a hard times at this but you successfully guided me through 😉
@akhil__ig
@akhil__ig 2 жыл бұрын
Thank you So much ✌️
@intisher9363
@intisher9363 2 жыл бұрын
structure and algorithm (DSA) topics,love your new look
@yohansenurga4044
@yohansenurga4044 3 жыл бұрын
Wow, Saldina thank you very much. I learned about the linked list in my c++ class course but I didn't understand much. Now I saw your video and it helped me a lot. And one more thing can you please make a video/videos about c++ classes using different(separate) files like header file - c++ file - main function file. Thank you in advance.
@arnavnegi3358
@arnavnegi3358 2 жыл бұрын
thank you mam. This turned out to be really helpful.
@prathagautam9872
@prathagautam9872 Жыл бұрын
Thank you!
@ishaanpunetha
@ishaanpunetha 3 жыл бұрын
was so passionate about coding I'm just a young teenager....I also learnt c++ from an internet website for free....but as my exams approached my mom took my laptop for 2 months ....now I'm watching your that whole c++ video I was very sad about what happened but I'm back again! Thanks Hope you make more cources for different programming languages as well....
@hassannawaz661
@hassannawaz661 3 жыл бұрын
Thank you so much!
@CaptainBravo87
@CaptainBravo87 2 жыл бұрын
A great one .. thx!
@DNicco_
@DNicco_ 2 жыл бұрын
Another great video beauty!
@michaelsoriano7445
@michaelsoriano7445 3 жыл бұрын
Great work
@habtamukeno8198
@habtamukeno8198 2 жыл бұрын
live long life, thank you my sister, super linked list vedio tutorials
@michaelfgondwe
@michaelfgondwe 3 ай бұрын
The video have added more clarity on the coding experience
DO YOU HAVE FRIENDS LIKE THIS?
00:17
dednahype
Рет қаралды 49 МЛН
КАРМАНЧИК 2 СЕЗОН 7 СЕРИЯ ФИНАЛ
21:37
Inter Production
Рет қаралды 466 М.
small vs big hoop #tiktok
00:12
Анастасия Тарасова
Рет қаралды 28 МЛН
Adding elements to a linked list
18:46
CodeVault
Рет қаралды 38 М.
What are header files in C++ ( PROGRAMMING TUTORIAL for beginners)
23:54
WHY did this C++ code FAIL?
38:10
The Cherno
Рет қаралды 190 М.
you will never ask about pointers again after watching this video
8:03
Low Level Learning
Рет қаралды 2,1 МЛН
Learn Linked Lists in 13 minutes 🔗
13:24
Bro Code
Рет қаралды 263 М.
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 2,5 МЛН