How to Create a Linked List C++ Introduction to Linked Lists

Share
Embed
  • Published on Dec 12, 2012
  • This tutorial provides clear visual representation of what is happening as a linked list is coded.
    Want to learn C++? I highly recommend this book amzn.to/1PftaSt
    Donate bit.ly/17vCDFx
    STILL NEED MORE HELP?
    Connect one-on-one with a Programming Tutor. Click the link below:
    trk.justanswer.com/aff_c?offer_id=2&aff_id=8012&url_id=238

    :)

Comments • 652

  • M B
    M B 9 days ago

    This is literally the best video ever!!!!!

  • Keng Thế
    Keng Thế 11 days ago

    thanks for the very useful course sir!

  • Brando Casas
    Brando Casas 15 days ago

    Thanks for the video. Could you please write the statement to print out the value of the 4 linked list element?

    I think is maybe something like this :

    h -> next -> next -> next -> data

    or just

    n -> data

  • Karan Doshi
    Karan Doshi 27 days ago

    well explained

  • Rachana Singh
    Rachana Singh 27 days ago

    great video, thank you so much

  • Keysang Yonthan
    Keysang Yonthan Month ago

    OMG thank you........... so much!!

  • devesh more
    devesh more Month ago

    Sir what a great way of explanation.... I was stuck on this topic a long back .... None of my clg faculty was able to explain Mee like this

  • Xolani Nqubezelo
    Xolani Nqubezelo Month ago

    Thank you sir!!

  • Ishika Jain
    Ishika Jain Month ago

    great explanation. thank you!!!!!

  • Prõff Rãms
    Prõff Rãms Month ago

    awesome video :-)....I think you should have called t tail since it points to the tail.

  • Brand M
    Brand M Month ago

    thanks

  • Micah
    Micah Month ago

    Just curious, could you do this backwards and then set node* last; instead so you could create each w/ one line instead
    struct node{
    node(node & t){
    last = t;
    t = this;
    }
    int data;
    node* last;
    }
    node t;
    node n = new node(t);
    n->data = 1;
    node n = new node(t);
    n->data = 2;
    Something like this? On phone rn and this is first time I’ve seen a linked list or heard of it so just curious but no way to chekc

  • Ahiduzzaman Ahir
    Ahiduzzaman Ahir 2 months ago

    WTH??? Its so easy......Why tf am I paying UNI??

  • Jagadeesh Relli
    Jagadeesh Relli 2 months ago

    Good explanation, thank you so much

  • Tung nguyen cong hoang
    Tung nguyen cong hoang 2 months ago

    wow, thank you so much Paul. The way you explain the linked list was very understandable and easy to comprehend, which probably saved me hours watching other's videos. Much better than my university professor explanation.

  • Ganesh Murmu
    Ganesh Murmu 2 months ago +1

    Best video on universe

  • Cresence Mnyanga
    Cresence Mnyanga 3 months ago

    There is error 'n' does not name a type

  • Cresence Mnyanga
    Cresence Mnyanga 3 months ago

    Thank you so much mr.iunderstand very well

  • Matt M
    Matt M 3 months ago

    Thank you so much for doing this. This variable pointers following each node is hard to explain and understand but you did a great job. I really wish arrays in C++ were such as in PHP where they were dynamic and you and have key value pairs and values that can be different data types..

  • Zaryab Ahmed
    Zaryab Ahmed 3 months ago

    Thank u,sir! You,ve explained it so good. I was trying to get this concept for atleast 3 hours but you,ve just explained it properly in just 12 mins

  • Adde Defreitas
    Adde Defreitas 4 months ago

    Thanks bro

  • cppNoob
    cppNoob 4 months ago

    hello everyone im starting my own linked list tutorial series and would appreciate anyone stopping by to check it out thank you thexvid.com/video/QBIsnFKh44k/video.html

  • RobertO
    RobertO 4 months ago

    The compiler reads and assigns data from left to right, you explained the process vice versa, also, why have two variables declared as n? you unassigned one and kept the other while still using the unassigned variable

  • Craig Coleman
    Craig Coleman 4 months ago

    Now to get things to compile?
    How is n declared in the main()?
    Nice video!
    // cwc pointers.cpp
    // reference thexvid.com/video/o5wJkJJpKtM/video.html
    // thexvid.com/channel/UCcDGsN3JxMavDkM9INRLGFA
    #include
    using namespace std;
    struct node{
    int data;
    node* next;
    };
    int main(){
    int t,h;
    n = new node;
    n->data = 1;
    t = n;
    h = n;
    n = new node;
    n->date = 2;
    t->next = n;
    t=t->next;
    n = new node;
    n->date = 3;
    t->next = n;
    n = new node;
    t=t->next;
    n->date = 4;
    t->next = n;
    n->next = NULL;
    return 0;
    }

  • XenomorphLV426
    XenomorphLV426 5 months ago

    Excelente

  • atsam ali
    atsam ali 5 months ago

    Thanks Alot

  • Sens Edits
    Sens Edits 5 months ago

    Thank you sincerely!!!

  • M.Talha Arshad
    M.Talha Arshad 5 months ago

    Beautiful explanation!

  • preity chib
    preity chib 5 months ago

    Thank u next 😅
    Just kidding, really it helped me alot sir .

  • shubhankar jadhav
    shubhankar jadhav 5 months ago

    thanks a lot bro

  • Mini Zacharias
    Mini Zacharias 6 months ago +2

    Wow.. You made it seem simple.. Luv from India
    2019 anyone??

  • انا مسلم و كفى

    whts the convert * in c#???

  • Thuyên Hà
    Thuyên Hà 6 months ago

    Thank sir. From VietNam

  • teemo captain1997
    teemo captain1997 6 months ago

    thanks you m8
    you help me alot

  • Joey Sheridan
    Joey Sheridan 6 months ago

    Great video! Thank you so much for the content

  • WesamConTECH
    WesamConTECH 6 months ago

    Great video I really appreciate the sequence you worked with.
    I've got a question though.. Is it possible to create a loop that generates this list until for example reaches number 5 of data? then the last node will point to NULL? Cause I want to shorten my code

  • Songsuk Dumrongwibulsin

    Thank you so much! YOU ARE THE BEST!!! Now I know what linked list is after scratching my head for so many days.

  • Gabriel Murillo
    Gabriel Murillo 6 months ago

    CS106B gang

  • Abdul Mueez
    Abdul Mueez 6 months ago

    this kind of basic code is perfect to understand link list thanks.

  • Hà Quang
    Hà Quang 6 months ago

    temporary for what? Actually don't understand

  • Mariam Albarghouti
    Mariam Albarghouti 7 months ago

    Thank you

  • Rodrix183
    Rodrix183 7 months ago

    Useful for my exams

  • yash chauhan
    yash chauhan 7 months ago

    Simply awesome, best explanation. Thumbs up for that

  • SharadRawat
    SharadRawat 7 months ago

    Great explanation! Thanks for being concise!

  • Savan Panchal
    Savan Panchal 7 months ago

    Explained Too Good!!!! Making Life Easy!!!!

  • Rahul Mundefi
    Rahul Mundefi 7 months ago

    finally understood it thanks

  • Taylor B
    Taylor B 7 months ago

    Your smoke detector is running low on battery, thanks for the wonderful explanation!

  • Ganesh Rajan
    Ganesh Rajan 7 months ago

    I LOVE YOU SO MUCH THANK YOU

  • ZombianGaming
    ZombianGaming 8 months ago

    yes perfectly n that helps bro

  • DODDY LINO SAKMAD -
    DODDY LINO SAKMAD - 8 months ago

    YOURE A GENIUS

  • Kaleem Ullah
    Kaleem Ullah 8 months ago

    Subscribed for this video

  • Salvatore Granata
    Salvatore Granata 9 months ago

    I've understand in 12 minutes everything you said speaking in english but nothing of 2 hours lesson of my Italian teacher.... LOVE YOU.
    A question: What happens if I write struct node n=NULL?
    I've noticed it is so important in my all programs but what does physically happen? In the n block you write NULL?

  • hotmandead1
    hotmandead1 9 months ago

    Great explanation

  • Sanjay Tumati
    Sanjay Tumati 9 months ago

    Hi Paul, You've assigned n= new node twice. It appears that when you assign n->data = 2, it will just rewrite the original location when you had written 1 to 2. You might need to create a new memory location, I think. Do let me know where I am going wrong.

  • MAXIMUM MAOKAI
    MAXIMUM MAOKAI 9 months ago

    Thank you very much. That is so helpful.

  • Florentin Niyongere
    Florentin Niyongere 9 months ago

    Awesome!

  • Kaushal Makwana
    Kaushal Makwana 9 months ago

    Wonderfully explained

  • Emmanuel Lazarte
    Emmanuel Lazarte 9 months ago

    This video is amazing. I'd like to watch a video like this about double linked list, is it possible that you can do it ? Thanks a lot

  • Emmanuel Lazarte
    Emmanuel Lazarte 9 months ago

    Nice, ty!

  • Walker Bass
    Walker Bass 9 months ago

    ily Paul