L23. Merge two sorted Linked Lists

Sdílet
Vložit
  • čas přidán 30. 12. 2023
  • Problem Link: bit.ly/3vjuaGQ
    Entire LL Sheet: takeuforward.org/linked-list/...
    Check our A2Z DSA Course: takeuforward.org/strivers-a2z...
    Please do give us a like, and subscribe to us if you are new to our channel.
    Do follow us on our socials: linktr.ee/takeuforward

Komentáře • 60

  • @shubhambhatt2704
    @shubhambhatt2704 Před 6 měsíci +91

    Bro woke up and dropped the whole playlist

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

    Definittely this is one of the best playlist on linked list in youtube.

  • @SaiSumanthKovuru
    @SaiSumanthKovuru Před 6 měsíci +7

    best series i have ever seen especially the dry run thank u so much for an exceptional series

  • @neerkhandor5007
    @neerkhandor5007 Před 6 měsíci +4

    Byfar the best linked list series
    Thank you very much Raj Bhaiya

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

    we missed youuu here ! KEEP UP THE GREAT WORK YOU'RE DOIN MAN

  • @robot3.077
    @robot3.077 Před 6 měsíci +1

    Bhaiya ,I can definitely say, you are god of DSA❤❤

  • @user-ds2ls5mf7r
    @user-ds2ls5mf7r Před 6 měsíci +6

    Great video, -->
    This video is not updated in the SDE sheet and in the Article as well.

  • @Bhawna-ir1gr
    @Bhawna-ir1gr Před 6 měsíci +1

    amazing explanation ✨✨

  • @hashcodez757
    @hashcodez757 Před 17 dny

    Epic bhaiya!!

  • @ManojKumar-do1rh
    @ManojKumar-do1rh Před 4 měsíci

    Thanks ... nice explaination

  • @crazyfacts4434
    @crazyfacts4434 Před 6 měsíci

    Very good explanation. 😊😊

  • @aakashbhandari9761
    @aakashbhandari9761 Před 6 měsíci

    Welcome Back sir❤🎉

  • @justsomeguywithoutamustach9978

    To be exact, time complexity would be O(min(n1 + n2)).

  • @adebisisheriff159
    @adebisisheriff159 Před 5 měsíci

    Thanks Striver!!1

  • @d.praful
    @d.praful Před měsícem

    Nice explanation ❤

  • @YourCodeVerse
    @YourCodeVerse Před 5 měsíci

    Understood✅🔥🔥

  • @ddevarapaga5134
    @ddevarapaga5134 Před 2 dny

    Best bhai Thank you

  • @subee128
    @subee128 Před 6 měsíci

    Thanks

  • @RituSingh-ne1mk
    @RituSingh-ne1mk Před 6 měsíci

    Understood!

  • @NARUTOUZUMAKI-bk4nx
    @NARUTOUZUMAKI-bk4nx Před 6 měsíci

    Understoood

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

    Bhaiya when can we expect stack queue playlist

  • @sujalsingh9365
    @sujalsingh9365 Před 6 měsíci

    Happy New Year 🎉

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

    Thanks for clean code. sudo code have minor issue , please correct it . if ( t1 -> data < t2 -> data ) You missed equal elements . it should be if ( t1 -> data data )

    • @anirudhv0062
      @anirudhv0062 Před 3 měsíci

      yes. I wondered the same. I came here from leetcode. there some values in the two sorted lists which are same. but what an explanation. I know only basics of linked lists. I was able to undersand well enough

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

      There is no need for this Equal to condition bcz it already handled by else part
      But it is good to think about this condition👍👍

    • @anirudhv0062
      @anirudhv0062 Před 3 měsíci

      @@ujjwalsingh6889 yes. I realized it later. when I did a dry run. Thanks for replying ujjwal

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

      @@anirudhv0062 You need to improve your DSA These are basics

  • @sohamsonwane1534
    @sohamsonwane1534 Před 6 měsíci +3

    meri tarf se ik papii supper good explanation

  • @RAHULSINGH-cd6gl
    @RAHULSINGH-cd6gl Před 6 měsíci

    On which topic you will be making your next playlist??

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

    why this problem is not in the A2Z sheet?

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

    Understood

  • @VibhaJamadagni-hz6ck
    @VibhaJamadagni-hz6ck Před měsícem

    understood

  • @ashishpradhan6250
    @ashishpradhan6250 Před 21 dnem

    Nyc

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

    What if I use a multiset instead of an array in brute force approach??

  • @ArpanChakraborty-do6yz
    @ArpanChakraborty-do6yz Před 4 měsíci

    Awesome 😎 17:36

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

    Can't we use dummy node to make it as a copy of the lowest head value of either of the lists (which acts as the head of the new merged list) , and repeat the same process . Will the solution be different ?

  • @codeman3828
    @codeman3828 Před 5 měsíci

    Undertsood

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

    shouldn't time complexity be min(n1,n2) coz this is where while stops and then it's just one extra link that we've to do?

    • @shahidullahmuffakir668
      @shahidullahmuffakir668 Před 3 měsíci

      if the smaller values were in the n2 then in this case we will traverse till the end of n2. so min(n1,n2) will not work.

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

    I couldn't find this question in the a2z playlist.

  • @dayashankarlakhotia4943
    @dayashankarlakhotia4943 Před 6 měsíci

    class Solution {
    public ListNode mergeTwoShortedLists(ListNode l1,ListNode l2){
    ListNode ans=new ListNode(-1);
    ListNode temp=ans;
    while(l1!=null&&l2!=null){
    if(l1.val

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

    I'm confused how the space complexity is O(1)? We are creating a dummy node which extends to hold the nodes of both linked list 1 and linked list 2. Don't the space complexity be O(n1+n2) where n1 are number of nodes in linked list 1 and n2 are number of nodes in linked list 2.

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

    8:15 Can anyone tell in which video dummy node concrpt is explained by him😅

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

    god

  • @Adarsh_agrahari
    @Adarsh_agrahari Před 6 měsíci

    Done and dusted😅

  • @ShivaMahajan07
    @ShivaMahajan07 Před 5 měsíci

    God or what

  • @rahulhembram4519
    @rahulhembram4519 Před 5 měsíci

    UnderStood

  • @nashratjahan9371
    @nashratjahan9371 Před 6 měsíci

    There's a little mistake at the end for handling remaining nodes after either one list has reached null, there should be a another while loop to handle those cases. Also there isn't a java code to the above problem kindly provide one

    • @gokulanvs
      @gokulanvs Před 6 měsíci

      No need for while loop , see the video 11:40

    • @md.ualiurrahmanrahat2400
      @md.ualiurrahmanrahat2400 Před 5 měsíci

      No,we don't need the while loop here. As we are using the exiting nodes itself,not creating new ones. Suppose n1 is null, so n2 is left. we pointed temp->next as n2. so, from here, link is maintained up to n2 becomes null. Hope you got this.

    • @pratiushkumar3306
      @pratiushkumar3306 Před 5 měsíci

      Wait what 😂 he did solved that with if else. Watch it completely before commenting.

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

    free(dummy node):

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

    us

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

    where the hell is the dummy node concept been spending hours to find but couldn't find it Someone plz pin it

  • @chinmayraichur8984
    @chinmayraichur8984 Před 5 měsíci

    Understood!

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

    Understood