Linked List in C++ - Part 1 | Lecture 50 | C++ and DSA Foundation Course

Sdílet
Vložit
  • čas přidán 7. 08. 2024
  • Have you heard of the data structure called a linked list? It's the most dynamic and versatile data structure as far as implementation is concerned.
    In this class, Urvi mam will cover linked list concepts from the very basics to the advanced implementations.
    Follow us to prepare for the college exams, interviews and placements with immaculate problem-solving and coding skills.
    See you in the class !!
    Are you finding the classes helpful?
    Stay tuned for more!
    Access the notes and assignments for this class for free at : pwskills.com/course/C++--Foun...
    PW Skills is announcing the launch of the following programs,
    Decode Batch:- DSA with C++
    pwskills.com/course/Decode-DS... (Hinglish)
    Binary Batch:- Java-with-DSA-&-System-Design (Java with DSA & System Design)
    pwskills.com/course/Java-with... (Hindi)
    pwskills.com/course/Java-with... (English)
    Sigma Batch:- Full-Stack-Web-Development (MERN Stack)
    pwskills.com/course/Full-Stac... (Hindi)
    pwskills.com/course/Full-Stac... (English)
    Impact Batch:- Data-Science-Masters (Full Stack Data Science)
    pwskills.com/course/Data-Scie... (Hindi)
    pwskills.com/course/Data-Scie... (English)
    Website - pwskills.com/
    Instagram - / pwcollegewallah
    LinkedIn - / ineuron-ai
    / physicswallah
    Telegram - t.me/SkillsPW
    Discord - / discord
    Twitter - / pw__skills
    PW Skills Instagram : / pw.skills
    00:00 - Introduction
    00:42 - Recap
    01:07 - Today's checklist
    01:27 - What is linked list
    03:52 - Challenges of an array
    09:00 - Advantages of linked list over an array
    12:39 - Listnode
    17:18 - Types of linked list
    20:06 - Implementation of a listnode in singly linked list
    24:14 - Traversal in a singly linked list
    28:24 - Insertion at kth position in a singly linked list
    50:57 - Updation at kth position in a singly linked list
    54:09 - Deletion at kth position in a singly linked list
    01:09:55 - Given the head of a linked list, delete every alternate element from the list starting from second element
    01:29:32 - Given head of a sorted linked list, delete all duplicates such that each element appears only once. Return the sorted linked list too.
    01:44:15 - Traversing in the reverse order
    01:55:27 - Given the head of a singly linked list, reverse the list and return the reversed list (Common and recursive both)
    02:21:19 - Given the head of a list, reverse the nodes of the list k at a time and return the modified list.
    #LinkedList #C++ #DSA #CollegeWallah #OneShot #PhysicsWallah

Komentáře • 146

  • @pranavpahuja2236
    @pranavpahuja2236 Před 9 měsíci +20

    was struggling with LL for more than a week..but came across this best lecture on LL❤❤..now pretty confident for exams....thank you maam❤❤

  • @samruddhipaiyawal5586
    @samruddhipaiyawal5586 Před 5 měsíci +2

    nice work on explaining the whole thing, your's is the first video where i did not get confused after watching it

  • @janmejaysahu9011
    @janmejaysahu9011 Před rokem +56

    For supporting team i would highly recommend to please add the all videos of the c++ DSA foundation course in playlist❤

  • @akash2700
    @akash2700 Před 9 měsíci +9

    1:55:27 Leetcode(206) - Reversing a linked list

  • @Urwa410
    @Urwa410 Před 5 měsíci +4

    Ma'am your way of teaching is just brilliant.

  • @vikk643
    @vikk643 Před měsícem +2

    Thankyou you mam for teaching dsa in easily ❤

  • @mihirkumar4770
    @mihirkumar4770 Před rokem +21

    your way of teaching is just brilliant. Harder the topic easier you make for us. Thanks a lot for this quality content.

    • @user-ft5qo5xp2o
      @user-ft5qo5xp2o Před 2 měsíci

      iske notes h aapke pass agr h to pls share kr dijiye

  • @keshavmehra2177
    @keshavmehra2177 Před 8 měsíci +3

    Thanks a lot mem👍...your explanation is very helpful to me....

  • @LearnerAbhi21
    @LearnerAbhi21 Před rokem +19

    I got this finally!! Linked List is HARD to learn but its interesting to do operations on it .... many many Thanks to Urvi mam !!😇❣

    • @LearnerAbhi21
      @LearnerAbhi21 Před 2 měsíci +6

      here I am again on this video, after forgetting everything what i learnt 1 year before in April 2023.... Guys plz don't take any break during DSA journey, you will forget everything, and phir se track pr aane ke liye bhi bahot himmat aur mehnat lagti hai!🙏🙏🙏!(17 May 2024)

  • @kalashsingh8140
    @kalashsingh8140 Před 7 měsíci +3

    smooth....very grateful to u mam😍😍😍

  • @kingatshering5339
    @kingatshering5339 Před 4 měsíci +1

    very Impressive ! I really enjoyed learning from your videos.

  • @rahulrai7626
    @rahulrai7626 Před 8 měsíci +5

    best video for linked list in youtube❤❤❤❤

  • @AbhinavSingh-up7bl
    @AbhinavSingh-up7bl Před 10 měsíci +5

    1:10:50
    Thanks to you i was able to do it in less than 15 min
    void solve(Node* &head) {
    Node* temp = head;
    while(temp != NULL) {
    Node* dele = temp;
    dele = dele->next;
    temp->next = dele->next;
    free(dele);
    temp = temp->next;
    }
    }

  • @himalayadebbarma-we4pt
    @himalayadebbarma-we4pt Před 6 dny +1

    last question is a leetcode hard version Actually maam taught it soo easily

  • @lakshyagupta9435
    @lakshyagupta9435 Před 10 měsíci +4

    One of the best lectures on the linked list I have ever come across.

  • @solarsystem9156
    @solarsystem9156 Před 2 měsíci +2

    GUYS A SMALL UPDATE IN LAST QUES.
    IF K=4, ANSWER MUST BE: 4->3->2->1->5->6 *, as we have rotate K nodes only.
    So what y'all can do is:
    Node* check = head;
    int len = 0;
    while(check!=NULL){
    check = check->next;
    len++;
    if(len==k) break;
    }
    if(len

  • @ahmedali3017
    @ahmedali3017 Před 11 měsíci +4

    I highly appreciate you.
    The way of teaching is very effective.

  • @DownShifteroffical
    @DownShifteroffical Před 11 měsíci +4

    Well explained. I was struggling to understand LL . but after watching this session it clear my all doubts.

  • @prathmeshmore1033
    @prathmeshmore1033 Před 4 měsíci +2

    What is the base case for reversing k nodes In last recursive code?

  • @Breathing_beats
    @Breathing_beats Před 2 měsíci +1

    thanks a lot

  • @Nikhilgupta-mc9kc
    @Nikhilgupta-mc9kc Před 3 měsíci

    Thank you mam ❤❤

  • @amarjeet8120
    @amarjeet8120 Před rokem +8

    Please mam don't compromise the quality of content we are following from the 1st now you sumup all these contents in one series please sir try to cover all the topics we are following from the starting.

  • @tanishjotbrar8862
    @tanishjotbrar8862 Před rokem +3

    mam genuinly u r so gud ...its my first tym comin to ur channel nd for sure not the last..

  • @nishithkotak5002
    @nishithkotak5002 Před měsícem

    Hello, thanks for the wonderful explanation. Can you plz provide with the notes and code of the playlist for the learning purpose. Thanks

  • @kartikeykumar6165
    @kartikeykumar6165 Před 9 měsíci +6

    mam apne dynamic memory allocation padhaye bina pura linked list padha diya
    bina dynamic memory allocation k kisi ko kuch samajh nhi ayga ki kya chl rha hai

    • @neverstoplearning3451
      @neverstoplearning3451 Před 8 měsíci

      Hii bhai vo kaha se sikhe ?? Muje ye pointers kaise use kiye is tarike se ye nahi samaj aaya itna pointers pata hai par itna deep me nahi samaj aaya

    • @kartikeykumar6165
      @kartikeykumar6165 Před 8 měsíci

      bhai me recommend krunga ki tum double pointers aur pass by reference ache se sikh lo
      aur dynamic memory allocation aur oops codeHelp se sikh lena@@neverstoplearning3451

  • @anjaliChaudhary-tu1cd
    @anjaliChaudhary-tu1cd Před měsícem +1

    Newhead will be passing means new head will be returning that's why we are using node *????

  • @pandeynikhilone
    @pandeynikhilone Před 4 měsíci +1

    My fav DS is BST!!

  • @mercilessgoku4334
    @mercilessgoku4334 Před 17 dny +1

    The link for notes is not working

  • @PankajSingh-rc1pr
    @PankajSingh-rc1pr Před 11 měsíci +2

    Feeling Blessed Thank You MAM🤩

  • @samriddharoychowdhury2599
    @samriddharoychowdhury2599 Před 4 měsíci

    great

  • @RahulKumar-md5ml
    @RahulKumar-md5ml Před 8 měsíci +2

    Where shall I find pdf of this lecture?

  • @akash2700
    @akash2700 Před 9 měsíci

    need some correction in the last problem for ex [1,2,3,4,5] and k=3 output should be [3,2,1,4,5] but it is returning [3,2,1,5,4]

  • @priyankapatidar_CS
    @priyankapatidar_CS Před rokem +3

    Yess mam we want a next some videos of binary tree, heap, graph, greedy algo and some other important topics of DSA plss mam I would highly recommend pls add some next videos. Thank you so much for deep explaination❤️💯

  • @Batmanishere1243
    @Batmanishere1243 Před 9 měsíci +4

    Please make the notes accessible
    We can't access them it shows some errors...

  • @57-ajityadav46
    @57-ajityadav46 Před 3 měsíci +1

    31:35 head ka pointer change karne kai liye head = new_node; kiya hai

  • @ieroo3773
    @ieroo3773 Před 9 měsíci

    can you run translation

  • @mukulbassi4920
    @mukulbassi4920 Před 2 měsíci

    was searching for a good explanation found this, i took 3 days to properly watch and make codes on my own. Gotta say this really helped thank you so much.

  • @UPEShahidAnawarMamud-km6mh

    Didi Thanks 🥰

  • @user-ft5qo5xp2o
    @user-ft5qo5xp2o Před 2 měsíci

    Mam i can't find notes of this lecture

  • @OSAMAKHAN-ek6cn
    @OSAMAKHAN-ek6cn Před 3 měsíci

    maam apki tree data structure ka playlist hai?

  • @RelaxingMusic-ts9xx
    @RelaxingMusic-ts9xx Před 9 měsíci +1

    it will gives me an errror while i accessing Notes

  • @OSAMAKHAN-ek6cn
    @OSAMAKHAN-ek6cn Před 5 měsíci

    hello ma'am , can you provide us this code

  • @shivamjha8985
    @shivamjha8985 Před rokem +2

    Ma'am there is one thing for sure that because of this One shot thing the practice question have not been provided on the site and also The playlist for C++ course has not been updated yet. I have been trying to reach out for this for days now and haven't received some solution. And the assignments which are on the site are even not granting us access so please get it checked and do upload assignments so that we could practice regularly.

  • @AkashSharma-qg7ex
    @AkashSharma-qg7ex Před rokem +1

    Guys.. pls tell me how can I get the notes of this lecture and all previous lectures

  • @HassanMedia-jp8fr
    @HassanMedia-jp8fr Před 4 měsíci

    lots of respect from Pakistan maam

  • @debarghyakundu908
    @debarghyakundu908 Před 9 měsíci +1

    pls share the code mam

  • @qasimnawaz7290
    @qasimnawaz7290 Před 8 měsíci

    From ucp lahore❤

  • @akhilsinghrajput8100
    @akhilsinghrajput8100 Před rokem +12

    Plz provide 1 hr lecture topic wise , don't do that sum up in one lecture
    Till 47 lectures content is top class but now quality has been compromised 😕😕

  • @vanced5328
    @vanced5328 Před rokem +3

    Please make a video on TCS NQT 2023 test.
    How to prepare?
    What to read?
    Where to practice?
    How much coding is required?
    What is the smart way to practice test within short time?

  • @Tanjirou7781
    @Tanjirou7781 Před 10 dny

    Can anyone send me this video's codes please ??

  • @gaurangaggarwal6464
    @gaurangaggarwal6464 Před měsícem

    what is the use of arrow in coding???

  • @Abhishek-qx9zg
    @Abhishek-qx9zg Před 8 měsíci

    2:45:16 ❤❤❤

  • @durgeshsingh6380
    @durgeshsingh6380 Před rokem

    Good 👍

  • @ompatel2212
    @ompatel2212 Před rokem

    best video

  • @anmolkumar01
    @anmolkumar01 Před rokem +1

    1:28:38 - exactly same code for deleteAlternateNodes is showing segmentation fault in vs code (in pw labs) , i have checked the code but it is same , it is now showing segmentation fault on removing curr_node != Null from while condition ...
    Anyone ..? who can help...?

    • @hiteshsharma5034
      @hiteshsharma5034 Před 11 měsíci

      void deletealternative(Node* &head){
      Node* temp=head;
      while(temp->next!=NULL){ //1->2->3->4->null
      Node *garbage=temp->next;
      temp->next=temp->next->next;
      free(garbage);
      temp=temp->next;
      }

      } Try this in your compiler, its working fine if even no. of elements are in list.

  • @lakshmanlomisa7375
    @lakshmanlomisa7375 Před rokem +2

    one word for you -"thank you"

    • @SohelDarwajkar
      @SohelDarwajkar Před 10 měsíci

      Arigato Guzaimasu will be more suitable 😊

  • @itsevan4338
    @itsevan4338 Před 10 měsíci

    Awesome

  • @kartikgarg4742
    @kartikgarg4742 Před rokem +1

    mam please upload the notes of the lecture

  • @rohansaini1530
    @rohansaini1530 Před rokem +1

    Mam please upload video regularly

  • @ArGha03
    @ArGha03 Před 9 měsíci

    41:58

  • @hq.i
    @hq.i Před 3 měsíci

    2:20:53

  • @harshityadav8852
    @harshityadav8852 Před měsícem +1

    bhai line by line explain to kardo likhte time code .. line 18 mei kyu kia hai aisa ye sab kaun btaega?? ye to wohi smajh skta hai jisne 2-4 baar pehle se padha ho ye topic.

    • @sparshsingh7543
      @sparshsingh7543 Před 29 dny +2

      maam bas apna padha rhi hain , isme itne sare cheezen hain jo pehle ke lectures me shi se explain bhi nhi kra

  • @rohansaini1530
    @rohansaini1530 Před rokem +1

    Aaj pw ka app and PW skills ki site nhi chl rhi

  • @bonkai.movies
    @bonkai.movies Před rokem +4

    Long Time awaited🥱🙏

  • @anisharajput6871
    @anisharajput6871 Před rokem +1

    But in the function insertAtHead it gives an error can't convert node*to int in assignment new_node = head

  • @paragjain6165
    @paragjain6165 Před rokem

    While inserting a node at last in an empty node at 40:43 the code is not working in vs code

    • @AbhinavSingh-up7bl
      @AbhinavSingh-up7bl Před 10 měsíci

      40:00 if you have not insert any element into head and your head is NULL and you are trying to do same as she did you will get error so instead of doing that add this on insertAtTail() if(head == NULL) head = new_node; and put everything along temp inside else ,,, reason :: she inserted element while teaching insertAtHead so her head was not NULL...

  • @kk-nm5zz
    @kk-nm5zz Před rokem

    Mam mujhe plz reply karo
    Mai decode batch login nhi ho raha h
    Maine subscribe ker liya h please
    Batch update ho raha h kya🙏

  • @randomsmile7066
    @randomsmile7066 Před rokem

    Sir main kal se pw skill mein log in nhi kar pa Raha hoon.
    Mere video backlog increase ho raha hai please resolve my problem.

  • @aroranikunj277
    @aroranikunj277 Před 11 měsíci +1

    1:27:51 But why not current->next = temp->next??? 🚨⚠️

  • @ranvirvlog887
    @ranvirvlog887 Před rokem +2

    mam please video regular upload ki geya

  • @vishalsharma4799
    @vishalsharma4799 Před rokem +3

    Please continue java dsa series it's been more than a month but no video uploaded yet

  • @aryanmaniyar3475
    @aryanmaniyar3475 Před 11 měsíci +1

    I know I am late, and I am sorry, but a very Happy Belated Teachers day Team :)

  • @aesthetic._.rohit_
    @aesthetic._.rohit_ Před 7 měsíci +3

    JO AATA THA VO BHI BHUL GAYA 👍

  • @adityabharti1826
    @adityabharti1826 Před rokem +5

    ma'am made a movie on linked list😆😆

  • @Rajesh-pc2rq
    @Rajesh-pc2rq Před rokem +1

    I am third ...😊

  • @AbhinavSingh-up7bl
    @AbhinavSingh-up7bl Před 10 měsíci +1

    40:00 if you have not insert any element into head and your head is NULL and you are trying to do same as she did you will get error so instead of doing that add this on insertAtTail() if(head == NULL) head = new_node; and put everything along temp inside else ,,, reason :: she inserted element while teaching insertAtHead so her head was not NULL...

  • @bidhanchakraborty3783
    @bidhanchakraborty3783 Před 10 měsíci

    notes?

  • @janmejaysahu9011
    @janmejaysahu9011 Před rokem +2

    Java mai jese 5 hours ki interview questions upload kiye ho bas c++ mai vi usi questions ko chod ke baki Jo leet Code mai linkedlist ki questions hai us upar eka video bana dije mama

  • @ramanshrivastava1407
    @ramanshrivastava1407 Před rokem +4

    Aur kitne topic bache hai🤯

    • @goblinftw8428
      @goblinftw8428 Před rokem +1

      tree , graph , stacks , queue etc

    • @godson200
      @godson200 Před rokem +2

      Bhay DSA hai.
      Data structures
      1. Array
      2. Linked List
      3. Stack
      4. Queue
      5. Binary Tree
      6. Special Trees
      7. Graph
      8. Heap
      9. Tries
      10. Miscellaneous
      Algorithm
      1. Divide and Conquer
      2. Greedy Method
      3. Branch and Bound
      4. Backtracking
      5. String Algorithm and KMP matching
      6. Graph Algorithms
      7. Miscellaneous.
      Har kisi ka 3-4 ghante ka video banna chahiye approx.

    • @ramanshrivastava1407
      @ramanshrivastava1407 Před rokem

      @@godson200 bhot time lgega bhai kyuki video bhut slow upload ho rhi hai

    • @godson200
      @godson200 Před rokem +2

      @@ramanshrivastava1407 6 mahine kaha tha naa.
      DSA yaar ek baar karna chahiye lekin shaanti se.
      Ek accha course banane m 1-1.5 year lag jayega lekin wo for the ages rehna chahiye.
      Ye patience naa students mein hai na teachers mein hai.
      Toh ab yehi mediocre content se kaam chalana pahdega

    • @ramanshrivastava1407
      @ramanshrivastava1407 Před rokem +2

      @@godson200 🙏🙏offline soch rha hu ab

  • @AbhishekKumar-mb3gz
    @AbhishekKumar-mb3gz Před 10 měsíci

    mam inseartAtTail () function
    give me error

  • @aniruddhakarmakar2685
    @aniruddhakarmakar2685 Před 10 měsíci

    2nd question me segmentation fault ahha raha hai.... Why

  • @jasusuthar4370
    @jasusuthar4370 Před 10 měsíci

    source code milega kahi?

  • @ramanshrivastava1407
    @ramanshrivastava1407 Před rokem +1

    4th viewer🎉🎉

  • @studybiz5515
    @studybiz5515 Před rokem

    I am 2nd

  • @sumitsahni5402
    @sumitsahni5402 Před rokem +1

    Int a; a ka data type Int hai. similarly
    Node *next; next pointer ka data type Node hai. 👍
    it should not be written like Node* next . ❌

    • @rishabhinc2936
      @rishabhinc2936 Před rokem

      what about node* &head?
      and what about Node* reverseLinkedList() ???

    • @sumitsahni5402
      @sumitsahni5402 Před rokem +1

      writing node* &head and node *&head in the parameters are equivalent.

    • @rishabhinc2936
      @rishabhinc2936 Před rokem

      @@sumitsahni5402 and bro what about writing node* as a return type for a function

  • @shankarvishalsharma
    @shankarvishalsharma Před 11 měsíci

    Good, but pure lecture mein for loop se input Lena toh sikhaya hi nahin gaya

  • @DOINGSOLUTIONS
    @DOINGSOLUTIONS Před 10 měsíci

    BHAIYA ME AAPKI SAARI VIDEOS SE STUDY KRTI HU...AND MOBILE ME PRACTICE KRTI HU...
    I CAN'T AFFORD LAPTOP
    I REQUEST PW TEAM TO OFFER LAPTOPS TO NEEDY STUDENTS 😞

  • @STATUSRAJAHINDUSTANI
    @STATUSRAJAHINDUSTANI Před rokem

    I am first viewer 😃

  • @xxyyzz751
    @xxyyzz751 Před rokem

    1hr30min

  • @user-uk2eg1uh6o
    @user-uk2eg1uh6o Před rokem +1

    please itne bade bade lecturee mt do dekhne mai aatma bahar aa jati haii 🙏🙏🙏🙏🙏🙏

  • @user-lu8no5hw5b
    @user-lu8no5hw5b Před 8 měsíci

    With all due respect whatever you are teaching is not best practice for coding in DSA.

  • @brawlysnap1522
    @brawlysnap1522 Před rokem +38

    I want to marry urvi maam

  • @AkashKumar-wd2wi
    @AkashKumar-wd2wi Před 4 měsíci +1

    2025 me iss lecture ko dekhne vale kitne hai😊...

  • @rishabhinc2936
    @rishabhinc2936 Před rokem

    (reverse k-list full iterative)
    void reverse_k_list(Node* &head,int pos)
    {
    Node* temp = head;
    Node* prev_temp=NULL;
    Node* temp1=head;
    int p=1;
    while(p!=pos)
    {
    temp1=temp1->next;
    p++;
    }
    Node* newhead=temp1;
    while(temp!=NULL)
    {
    int k=1;
    Node* next =temp->next;
    Node* prev =NULL;
    Node* dummy=temp;
    while(k!=pos && temp!=NULL && temp->next!=NULL)
    {
    temp->next = prev;
    prev=temp;
    temp=next;
    next=next->next;
    // temp->next = prev;
    k++;
    }
    temp->next=prev;
    if(prev_temp==NULL)
    {
    prev_temp=dummy;
    }
    else{
    prev_temp->next = temp;
    prev_temp=dummy;
    }
    // dummy=temp;
    prev=temp;
    temp=next;
    }
    head=newhead;
    return;
    }

  • @awake7179
    @awake7179 Před rokem

    Handwriting is poor

  • @DOINGSOLUTIONS
    @DOINGSOLUTIONS Před 10 měsíci

    BHAIYA ME AAPKI SAARI VIDEOS SE STUDY KRTI HU...AND MOBILE ME PRACTICE KRTI HU...
    I CAN'T AFFORD LAPTOP
    I REQUEST PW TEAM TO OFFER LAPTOPS TO NEEDY STUDENTS 😞