Linked Lists for Technical Interviews - Full Course

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

КОМЕНТАРІ • 222

  • @lily_h-m7j
    @lily_h-m7j 2 роки тому +79

    I've watched sooooooooo many UA-cam tutorials - this guy is legit the best teacher I've come across so far! Very clear. Thank you so much Alvin

  • @ragsbigfella
    @ragsbigfella 2 роки тому +244

    I love Alvin's way of teaching. I loved his Dynamic programming video. Please ask him to make some more videos like Graphs and Trees.

    • @spaceface2288
      @spaceface2288 2 роки тому +4

      He already made videos on those topics bruh

    • @veganaiZe
      @veganaiZe 2 роки тому +7

      Graphs: ua-cam.com/video/2_Uuixtc5i0/v-deo.html

    • @calebo.a.6270
      @calebo.a.6270 2 роки тому

      Same here

    • @mehulsolanki9435
      @mehulsolanki9435 2 роки тому +3

      @@spaceface2288 He's going to love them.

  • @m.y.7230
    @m.y.7230 7 місяців тому +1

    Hands down the best explanation for linked list. It finally clicked on me after 3 days banging my head against the wall. His algorithms are way more intuitive, both iterative and recursive versions, much much more than what other instructors talked about. Thank you!

  • @maozbenkalif598
    @maozbenkalif598 2 роки тому +23

    08:25 one small correction, the order of inserting a node to a linkedlist is that the node you wish to enter has to point first to the node and then you have to take node b to point on node q, if you start by pointing b to q first you will lose all the data of c and d. Great video !! loved it

    • @ehabahmedyassen
      @ehabahmedyassen Рік тому +2

      yup, q.next = c then b.next = q

    • @pharaoh9483
      @pharaoh9483 Рік тому +1

      Oof, hate when people teach wrong things, they should have re edited the video

  • @AshenafiGodana-m1u
    @AshenafiGodana-m1u 3 місяці тому

    This is the only programming video I watched from start to finish with one sitting and I clearly understood LinkedList. Thank you Alvin!

  • @Jamesxoxo89
    @Jamesxoxo89 Рік тому +2

    Started learning linked list this week and could not understand the code for it at all until this video... Super appreciative, this community exists.

  • @EnriqueMoranG
    @EnriqueMoranG 2 роки тому +31

    Bro you explain so good that i've been able to perform the tasks without watching the whole video. Just got the idea and solved it by myself. I love you, Alvin. Happy New Year, mate!

  • @chukwunta
    @chukwunta Рік тому +11

    This is all you need to learn about linked-list. This is my fifth time viewing and I always seem to comeback and learn something new. It is such an amazing resource. Thanks @Alvin

  • @Pupu._
    @Pupu._ 2 роки тому +2

    Alvin is so to the point and voice is good to hear 🙌

  • @morenomt27
    @morenomt27 2 роки тому +4

    Thank you for this Alvin. I had a hard time refreshing linked list by watching countless tutorials and I can't understand why I can't move on with problems. While you are explaining, I am able to answer problems!

  • @zeynepdagci2801
    @zeynepdagci2801 2 роки тому +10

    your courses're amazing!! I have an interview with google in a couple of hour, I hope your courses work for me !!!

  • @AnkurSharma-hf9jn
    @AnkurSharma-hf9jn Рік тому +1

    Best explanation ever Now I'm much more confidence writing link list problem.

  • @tf1n
    @tf1n 2 роки тому +7

    Best video on LL’s that I’ve seen. Thank you, Teacher Alvin!

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

    Absolutely the best tutorial video on linked lists. Thank you so much, Alvin! Fantastic teacher.

  • @Luke-gr6dg
    @Luke-gr6dg 7 місяців тому

    I love that you said "A"'s next is "B". That makes link list much easier to conceptualize than other sources which overly complicate it.

  • @pankkajsen
    @pankkajsen 2 роки тому +7

    Given a blind like because of Alvin👍…and added to my “Immediate watch” list 😀

  • @ArudSekaBerneLearnings
    @ArudSekaBerneLearnings 5 місяців тому

    I love the way he explain and able to grasp things even though I am a beginner.

  • @RahulD600
    @RahulD600 2 роки тому +13

    I love Alvin's way of teaching! He's really a master! Thank you very much!

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

    man this is the best explanation ever.

  • @a_maxed_out_handle_of_30_chars
    @a_maxed_out_handle_of_30_chars 2 роки тому +9

    seeing alvin puts a smile on my face :)

  • @tonyseben
    @tonyseben Рік тому +2

    For the iterative Zipper implementation, we need a null check for head1 (ideally for head2 as well). if(head1 === null) return head2; if(head2 === null) return head1;

  • @skitzhills
    @skitzhills Рік тому +1

    Alvin you are the best programming sensei. This Linked List tutorial is just ridiculously good...

  • @myrusEW
    @myrusEW Рік тому +14

    I just realized watching theory tutorials in other languages actually makes learning so much more intuitive, since you can't just blindly copy. You're forced to understand how your language works, and you're forced to implement those ideas without really being able to "cheat". Wow. I'm gonna start watching C tutorials and do them in python. I'm about to hit 10x developer once I understand all this

    • @servantofthelord8147
      @servantofthelord8147 Рік тому +1

      This is a very good point. I never realized this. This whole time I was trying to avoid tutorials in different languages, not realizing that they were the key to helping my solidify my understanding. Good observation!

    • @madman3727
      @madman3727 11 місяців тому +2

      same I was forced to code this in my learning language and I was surprised to see how quickly I learned

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

    Alvin we need more of you guys. Grow up your channel. You are a hero

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

    You are amazing Alvin! I've learned a lot from you🙌

  • @gautamgunecha5963
    @gautamgunecha5963 2 роки тому +3

    His tutorial are pure 💎

  • @foravidalalsharma1291
    @foravidalalsharma1291 2 роки тому +8

    I wish you had Java as one of the programming languages, but I still loved your course and was able to interpret everything in Java because of how you explained the algorithms, it was so simple to even understand recursive, something I always mess up. Thank you!!

  • @omarkyon1933
    @omarkyon1933 2 роки тому +5

    Really cool to see you here Alvin. Great explanations as usual

  • @sriram-uu6yd
    @sriram-uu6yd 2 роки тому +5

    Trust me, I was searching for an hour yesterday to find a good resource to learn Linked Lists. Thank you, FCC.

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

    I like the way Alwin simplifies the concepts and problems. learnt a lot. Thanks

  • @anandvardhan2514
    @anandvardhan2514 2 роки тому +4

    Your videos are awesome..Saw your video on Dynamic programming and since then i am not facing any problem in solving such questions.

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

    what an excellent teacher!

  • @madhubalajayakumaran9340
    @madhubalajayakumaran9340 2 роки тому +2

    loved the explanation! Though I knew all these concepts before, I just watched anyway.

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

    Amazing, this guy is dynamic and engaging

  • @thelastminutetrade
    @thelastminutetrade 2 роки тому +10

    Bro your research and best way of analysis is amazing.
    Who else find this list helpful ❣️❣️

  • @sampathsai5509
    @sampathsai5509 2 роки тому +9

    I love the way you teach 😍.
    Please create a course on Backtracking.

  • @pauzhou8639
    @pauzhou8639 Рік тому +2

    omg who is this guy? He has the best algor interview videos !!

    • @andiuptown1711
      @andiuptown1711 Місяць тому

      Alvin! Ex Google engineer. He also put out a new React + Tailwind course

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

    What a co-incidence .tomorrow we have a amazon technical interview , hope It would help.

  • @tomashoracek7187
    @tomashoracek7187 8 місяців тому +1

    Awesome vids helping me with my uni subject Foundations of Programming, they give us 15 small programming exercises every week for points that count to final mark and also credit and they gave us exercises such as programm ringbuffer using linked list, program queues and stack using linked list. Merge two ordered linked lists and so on xd

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

    Thank you very much. The best explanaition of js linked lists

  • @stanleyjekwu6810
    @stanleyjekwu6810 2 роки тому +2

    The best I have seen so far...Thank you so much... I just checked your platform to make a purchase to go deeper but I couldn't find C# language option (that's my core language).
    I don't know if there will be room for that in the future?
    I greatly benefited from this JavaScript version.

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

    All the members of your department are great

  • @Sz-hi7wj
    @Sz-hi7wj 2 роки тому +1

    welcome back Alvin!

  • @rebeccaburch3334
    @rebeccaburch3334 Рік тому +2

    for zipperlist iterative approach, when you add the rest of the list that is leftover tail isn't reassigned to be the new tail. In this case, you're just using "tail" as a pointer to the current end of the constructed list. And tail isnt assigned at all in the recursive solution. Would there be an extra step to iterate through the leftover list to the end and reassign tail? Thanks for your great videos 🔥🔥🔥

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

    i rlly like the way you explain the problem step by step.

  • @hi-tk4hu
    @hi-tk4hu 2 роки тому

    Best video on LL for beginner

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

    Alvin you are a great teacher.

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

    Completed watching this tutorial, very informative, thanks a lot 🎉😊

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

    Bro your research and best way of analysis is amazing.
    Who else find this list helpful ️️

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

    Best teacher ever!!!

  • @ayushmishra6740
    @ayushmishra6740 5 місяців тому

    Smooth Explanation.

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

    BEST LINKEDLIST VIDEO EVER

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

    The way Alvin teaches linked lists makes these concepts NOde big deal. Haaa

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

    Love it as always! Big kudos!

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

    Excellent explanation

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

    I think it's much elegent this way. Anyway it was superb tutorial, Thanks Alwin!
    node *ZippedLL(node *A, node *B){
    if(!A) return B;
    if(!B) return A;
    node *ptrA = A;
    node *ptrB = B;
    while(ptrA && ptrB){
    node *nextA = ptrA->next;
    node *nextB = ptrB->next;
    if(ptrB) ptrA->next = ptrB;
    if(nextA) ptrB->next = nextA;
    ptrA = nextA;
    ptrB = nextB;
    }
    return A;
    }

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

      At least one error you will get is that you will be stuck in a loop. ptrA and ptrB are pointers and not booleans. Their values will likely be non-zero which will be interpreted as true. You need " While (ptrA != nullptr &&...) ". Something like that. Here is my code which I think works how you intended.
      /// Assumes that neither list is empty.
      void * zip(Node* f, Node* s){
      while(f != nullptr && s != nullptr){
      // Save next pointer.
      Node* n = f->next;
      // Point element from this list to other list.
      f->next = s;
      // Update first and second node.
      f = s;
      s = n;
      }
      }

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

      @@nonconsensualopinion it works the way it is intended, NULL will be treated as false. Your code it correct, but I am not quite sure where am' wrong

  • @rem.kudusov
    @rem.kudusov Рік тому

    Thank you, bro!

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

    The way you explain the link list, even a foolish can understand it. Thanks a lot 😊

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

    Thank you!

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

    Thanks. This is top notch. On my way to subscribe. Frankly best content ever. Quick and eloquent.

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

    last zipper recursion was awesome beauty

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

    My dude is back!!!

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

    ALVIN the GOAT!

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

    Great video Alvin!

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

    The Dynammic programming one was a blockbuster hence m here cheer

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

    you have saved my life

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

    The video that I had been searching. Thank you so much

  • @georgeimus6102
    @georgeimus6102 7 місяців тому +1

    not gonne lie thought this video was gonna be a waste of my time but I learned linked lists in just the first 15 mins of the video and was able to swift by these easily.

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

    Thank you so much. You're the best!!!!

  • @zfarahx
    @zfarahx 4 місяці тому

    Thanks!

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

    Great teacher!

  • @sufalt123
    @sufalt123 Місяць тому

    kinda cool that i found different (tho worse) solutions to some of the problems on my own :D

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

    I solved ZipperList iteratively without a counter to toggle between the two lists because at the start, i position the tail at the end of the initially constructed zipped list then within the while loop i construct the next node as a linkedlist of two nodes (current1.val) -> (current2.val) and then i update the tail and set the constructed two-nodes-list as its next then i refer to the last node of two-nodes-list i have just added as the new tail.
    private static Node zipListsIterative(Node head1, Node head2) {
    Node zipped = new Node(head1.getVal(), new Node(head2.getVal()));
    Node tail = zipped.getNext();
    Node current1 = head1.getNext();
    Node current2 = head2.getNext();
    while (current1 != null && current2 != null) {
    Node next = new Node(current1.getVal(), new Node(current2.getVal()));
    tail.setNext(next);
    tail = next.getNext();
    current1 = current1.getNext();
    current2 = current2.getNext();
    }
    if (current1 == null) tail.setNext(current2);
    if (current2 == null) tail.setNext(current1);
    return zipped;
    }
    and recursively, i wrote the recursive case as one liner by making use of the constructor: Node(String val, Node next)
    private static Node zipListsRecursive(Node head1, Node head2) {
    //base cases
    if (head1 == null && head2 == null) return null;
    if (head1 == null) return head2;
    if (head2 == null) return head1;
    //recursive case
    return new Node(head1.getVal(),
    new Node(head2.getVal(),
    zipListsRecursive(head1.getNext(), head2.getNext())));
    }

  • @TheManBehindTheScen1
    @TheManBehindTheScen1 7 місяців тому +1

    My Recursive Solution for Zipper List is MORE concise and easier to learn:
    const zipperLinkedListRec = (head1, head2) => {
    if (!head2) return;
    let temp = head1.next;
    head1.next = head2;
    zipperLinkedListRec(head2, temp);
    return head1;
    };
    *This assumes that both lists are non-empty like in video

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

    Excellent!

  • @elliptictree
    @elliptictree 11 місяців тому +1

    Good job.

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

    thanks ...appreciate it

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

    great help! thank you

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

    Alvin the boss

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

    muchas gracias !!!

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

    As Always, Thanks a Trillion.....
    ♥️♥️♥️♥️♥️♥️♥️♥️🌿🌿🌿🌿🌿🌿

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

    Beautiful!

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

    Alvin the boss is back in the hood!!!!!!

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

    9:07 Linked list insertion at an index which is not at the head or the tail should be O(k) Time right?

    • @Jutastre
      @Jutastre 3 місяці тому

      Yup, and because you're hopping through so many pointers, you get a lot more cache misses than an array, more often than not making it slower than an array in practice.

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

    Thanks a lot!!!

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

    Amazing !

  • @gunratnamore4250
    @gunratnamore4250 2 роки тому +3

    Helpful always 👍

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

    this is literally the best video I seen on this. However, you said it can be anything in the data. However, in C# and Java would be different. it would have to be what you choose it to be because you have to initialize the type of data it has to enter so all the nodes would have integers. Am I right or am I wrong?

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

    best teacher :DD

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

    thank you! needed this video!

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

    Awesome Video!!! thanks for the detail explanations.

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

    Thankyou Very Very Much🙂🙂🙂🙂🙂🙂

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

    Fantastic!!!

  • @mohamedtaherali8914
    @mohamedtaherali8914 10 місяців тому

    i think insertion in time complexity is O(n) in worst case this is most significant for linked list because we cant reach index till we reach the previous one and so on .. that's right ?

  • @Eslam-ig2gf
    @Eslam-ig2gf Рік тому

    Thanks

  • @dev-skills
    @dev-skills Рік тому

    19:15: great advice not to premature checking on linked list

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

    Hands down the best algorithm explanations. $ Structy purchase.

  • @iamlookto
    @iamlookto 2 роки тому +3

    Realy nice teaching style. Just one question. @ 37:00 it says the space is O(n) for the recursive sumList function. That is true for how it is implemented. But couldn't we also achieve O(1) by passing the sum variable into every recursion like it's done with the recursive linkedListValues? Wouldn't hat be much more optimised?

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

      From what I understand, space complexity of O(n) means, in the worst case there will be 'n' call stacks ( i.e when we reach the tail of the linklist), thus passing the integer as a argument will still create n call stacks, hence O(n).

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

      @@atharvarane6165 then why is it different in the recursive version of linkedListValues?

    • @atharvarane6165
      @atharvarane6165 2 роки тому +5

      @@iamlookto Must be a mistake, because the memory complexity is determined by the number of return statements because each function call will be stored on the program stack. To generalize, a recursive function's memory complexity is O(recursion depth). As our tree depth suggests, we will have n total return statements and thus the memory complexity is O(n).

  • @andr3w321
    @andr3w321 5 місяців тому

    @1:21:40 Unless I'm missing an edge case, there's no need for the count variable in the iterative zigzag solution. Just move tail twice in each while loop. C++ code below
    Node* zigzag3(Node* head1, Node* head2) {
    Node* tail = head1;
    Node* cur1 = head1->next;
    Node* cur2 = head2;
    while(cur1 && cur2) {
    tail->next = cur2;
    cur2 = cur2->next;
    tail = tail->next;
    tail->next = cur1;
    cur1 = cur1->next;
    tail = tail->next;
    }
    if (cur1) tail->next = cur1;
    if (cur2) tail->next = cur2;
    return head1;
    }

    • @sufalt123
      @sufalt123 Місяць тому

      this was my solution: template
      Node* zipper(Node* head1, Node*head2) {
      auto current1 = head1;
      auto current2= head2;
      while(current1 != nullptr && current2 != nullptr) {
      auto next1 = current1->next;
      auto next2 = current2->next;
      current1->next = current2;
      current2->next = next1==nullptr?next2:next1;
      current1=next1;
      current2 = next2;
      }
      return head1;
      }

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

    I love this channel