Inserting the Data at the Beginning of Single Linked Lists (Possible Mistake)

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 48

  • @rohans2002
    @rohans2002 3 роки тому +4

    Before watching the solution in the previous video, I'd tried the EXACT same thing and was confused why it didn't work. Glad I got the explanation here.

  • @swrjidaimary3871
    @swrjidaimary3871 4 роки тому +9

    I love neso academy. I am fully support neso academy by heart and soul.

  • @RaviShankar-ow9pu
    @RaviShankar-ow9pu 4 роки тому +27

    Sir plzzz increase the frequency of lectures!! 💗💝💗💝

  • @srivallimadduri1489
    @srivallimadduri1489 4 роки тому +19

    Good evening sir!
    I usually use my Lappy to learn but l opened the playlist in my mobile just to like and support ur channel which helped me to understand DS in a better way 😊.... Waiting for ur next topics of ds sir... Lover for neso academy from Andhrapradesh

    • @srivallimadduri1489
      @srivallimadduri1489 4 роки тому +1

      @Dipen Rana l didn't get if l should consider it as a compliment or a comment....

    • @karthik9354
      @karthik9354 3 роки тому

      What do you mean by support?

    • @srivallimadduri1489
      @srivallimadduri1489 3 роки тому +1

      @@karthik9354 support may mean suggesting to few of my frnds which in turn increase the no. Of views to the channel

    • @nisha..sharma..8554
      @nisha..sharma..8554 3 роки тому

      @@srivallimadduri1489 support from vizag

  • @Zero-ss6pn
    @Zero-ss6pn 2 роки тому +11

    You're just awesome. I made this mistake and wasn't aware of this possibility. Kudos to you brother!! Keep producing good content. Thanks a lot

  • @shivanidalal2860
    @shivanidalal2860 Місяць тому +1

    Best material so far I came across for link list

  • @rishikeshraj3252
    @rishikeshraj3252 10 місяців тому +1

    Sir I was also confuse about that i was thinking if I'm passing pointer to add_beg() then it is call by reference then why we should update the head.
    Thank your sir

  • @lawrencemuthui
    @lawrencemuthui Рік тому

    True and in the main function we are able to print the data of the now first node which is 3.
    Malloc in the add_beg() function allocate memory in the heap section which is available even after the function terminates.
    Should we free all the memory allocated at the end of the code?

  • @FaizanKhan-kn7op
    @FaizanKhan-kn7op 2 роки тому +5

    i did this mistake and stuck for 30 min in the code then i decide to
    continue the lecture and BOOM i got the solution😂

  • @daverussell4052
    @daverussell4052 3 роки тому

    totaly clear my doubt in the last lecture

  • @aashishbhatt4888
    @aashishbhatt4888 4 роки тому +3

    Please be consistent sir 🙏🙏🙏🙏🙏🙏

  • @divyamarora777
    @divyamarora777 2 роки тому

    good evening sir,
    I am from tech background and I love it
    thank you love you

  • @ambrishabhijatya7842
    @ambrishabhijatya7842 3 роки тому +1

    We could pass &head as a parameter to add_beg changing the type of the first argument to struct node** pointerToHead.
    Easier solution (perhaps a bad one?) would be to just put head in the global scope.

  • @prabhaskoya
    @prabhaskoya 2 роки тому +1

    Really really loved your content 💖💖💖💖

  • @saurabhkolapkar6277
    @saurabhkolapkar6277 4 роки тому

    Sir your lectures are awsomes
    Plz add the lectures of doubly linked list

  • @Harshit-ju2iz
    @Harshit-ju2iz Рік тому

    That's exactly the mistake I was making ;-; THANKS ALOT NESO!

  • @pratik__r__patil8838
    @pratik__r__patil8838 4 роки тому

    Damn Good yarr !
    Fantastic representation and Expalnation..
    Sir , you are Great..
    We support you sir ..we love THE NESO ACADEMY ...
    LOVE FROM the whole Maharashtra....

  • @beeanonymous5032
    @beeanonymous5032 3 роки тому

    Linked stacks and queues application of linked list. Bro needed this. Can u make a video?

  • @dipeshsamrawat7957
    @dipeshsamrawat7957 3 роки тому

    I love Neso Academy. 💝

  • @sarcasticboy4507
    @sarcasticboy4507 9 місяців тому

    oh my god you are legend. i exactly though of this when i watched just previous video. thank you for saving my life !!! now i am clear otherwise i also though its not necessay to do head =

  • @swrjidaimary3871
    @swrjidaimary3871 4 роки тому +1

    Sir Can you teach about system call using C like fork(), exec() etc on unix and for Windows CreateProcess (), WaitForSingleObject()

  • @prashantbhardwaj2675
    @prashantbhardwaj2675 3 роки тому +1

    hi neso academy...want to ask a question..we have allocated heap memory to head at the starting so it will not vanish out once the function will call of so how it could be pass by value..i m confused please explain.

  • @souradipkumarsaha9267
    @souradipkumarsaha9267 4 роки тому

    Sir you are great...hoping next videos soon ..stay safe sir🙏

  • @swrjidaimary3871
    @swrjidaimary3871 4 роки тому

    Please sir include some basic idea about system call using c or c++

  • @brianfinch0
    @brianfinch0 4 роки тому +1

    sir, please add subtitle for your videos it really helps, thanks

  • @Manimeghanath
    @Manimeghanath 8 місяців тому

    Thats the exact mistake i made b4 cing this video ........thanx buddy

  • @orijeetmukherjee9392
    @orijeetmukherjee9392 4 роки тому

    amazing work!!!

  • @dominiquefortin5345
    @dominiquefortin5345 2 роки тому

    The use of a caboose is another way and it simplifies all the code. struct node *createList() {struct node *nd = malloc(sizeof(struct node)); nd->link = nd; return nd;}; void insertBefore(struct node *nd, int new_data) {struct node *new_nd = malloc(sizeof(struct node)); new_nd->link = nd->link; new_nd->data = nd->data; nd->link = new_link; nd->data = new_data;}; Now all the other functions get simplified : void add_beg(struct node *head, int new_data) {insertBefore(head, new_data);}; void add_at_end(struct node *head, int new_data) {struct node *nd = head; while (nd->link != nd) {nd = nd->link;}; insertBefore(nd, new_data);}; void add_at_position(struct node *head, int new_data, in pos) {struct node *nd = head; --pos; while (nd->link != nd && pos > 0) {nd = nd->link; --pos;}; insertBefore(nd, new_data);};

  • @evssaini
    @evssaini 3 роки тому

    what if we declare head as global variable?
    wont it be easy?

  • @rugved4503
    @rugved4503 4 роки тому

    plzzz Plz add the lectures of doubly linked list

  • @abiadhimoolam1391
    @abiadhimoolam1391 6 місяців тому

    Sir pls provide english subtitles also sir

  • @killerqueen6023
    @killerqueen6023 3 роки тому +1

    I made same mistake, when performing this myself

  • @RohitRoy-cz2lo
    @RohitRoy-cz2lo 3 роки тому

    Can we use functions of both adding_node_at_end and adding_node_at_beginning to create our linked list,I have tried this and i am getting some error , can anyone guide me in this

  • @DaiMoscv
    @DaiMoscv 2 роки тому

    then how about we just return ptr instead of head

  • @A_sudden_stranger
    @A_sudden_stranger Рік тому

    I was doing this same mistakes 😢

  • @aditidana6159
    @aditidana6159 3 роки тому

    just wow

  • @squidward7421
    @squidward7421 7 місяців тому

    Instead of returning head, you could give head to the "add_beg(&head)" as a double pointer, this way you don't give the value inside of head, but the actually reference to head. In this case the code inside the function add_beg does need accordingly.
    For readability your way is certainly better.
    -edit
    nvm, you talk about this in the next video of the playlist.

  • @__Kuch_Bhi___
    @__Kuch_Bhi___ 6 місяців тому +1

    👍🙂

  • @snatamkamila8821
    @snatamkamila8821 3 роки тому

    grate

  • @AbcnaihauHnahUznnz
    @AbcnaihauHnahUznnz 2 роки тому

    While writing the code i made this mistake🤣🤣

  • @mohdmuqeem9291
    @mohdmuqeem9291 4 роки тому +1

    Sir please increase time also.videos are too short

  • @leenasharma4809
    @leenasharma4809 4 роки тому +1

    Purse