L23. Merge two sorted Linked Lists

  Рет қаралды 46,493

take U forward

take U forward

7 ай бұрын

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

Пікірлер: 61
@shubhambhatt2704
@shubhambhatt2704 7 ай бұрын
Bro woke up and dropped the whole playlist
@Hariprasath-bl6dt
@Hariprasath-bl6dt Ай бұрын
Turu
@SaiSumanthKovuru
@SaiSumanthKovuru 7 ай бұрын
best series i have ever seen especially the dry run thank u so much for an exceptional series
@ashwaniagrawal27
@ashwaniagrawal27 5 ай бұрын
Definittely this is one of the best playlist on linked list in youtube.
@user-ds2ls5mf7r
@user-ds2ls5mf7r 7 ай бұрын
Great video, --> This video is not updated in the SDE sheet and in the Article as well.
@neerkhandor5007
@neerkhandor5007 7 ай бұрын
Byfar the best linked list series Thank you very much Raj Bhaiya
@jnayehsirine6222
@jnayehsirine6222 4 ай бұрын
we missed youuu here ! KEEP UP THE GREAT WORK YOU'RE DOIN MAN
@robot3.077
@robot3.077 6 ай бұрын
Bhaiya ,I can definitely say, you are god of DSA❤❤
@Bhawna-ir1gr
@Bhawna-ir1gr 7 ай бұрын
amazing explanation ✨✨
@crazyfacts4434
@crazyfacts4434 6 ай бұрын
Very good explanation. 😊😊
@rajatraj4297
@rajatraj4297 Ай бұрын
why this problem is not in the A2Z sheet?
@hashcodez757
@hashcodez757 27 күн бұрын
Epic bhaiya!!
@ManojKumar-do1rh
@ManojKumar-do1rh 4 ай бұрын
Thanks ... nice explaination
@aakashbhandari9761
@aakashbhandari9761 7 ай бұрын
Welcome Back sir❤🎉
@itsd2388
@itsd2388 7 ай бұрын
Bhaiya when can we expect stack queue playlist
@d.praful
@d.praful Ай бұрын
Nice explanation ❤
@sujalsingh9365
@sujalsingh9365 7 ай бұрын
Happy New Year 🎉
@ddevarapaga5134
@ddevarapaga5134 12 күн бұрын
Best bhai Thank you
@YourCodeVerse
@YourCodeVerse 6 ай бұрын
Understood✅🔥🔥
@adebisisheriff159
@adebisisheriff159 5 ай бұрын
Thanks Striver!!1
@justsomeguywithoutamustach9978
@justsomeguywithoutamustach9978 Ай бұрын
To be exact, time complexity would be O(min(n1 + n2)).
@subee128
@subee128 7 ай бұрын
Thanks
@amarpalji
@amarpalji 5 ай бұрын
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 4 ай бұрын
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 3 ай бұрын
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 3 ай бұрын
@@ujjwalsingh6889 yes. I realized it later. when I did a dry run. Thanks for replying ujjwal
@rahulmandal4007
@rahulmandal4007 Ай бұрын
@@anirudhv0062 You need to improve your DSA These are basics
@abhishekprasad010
@abhishekprasad010 2 ай бұрын
What if I use a multiset instead of an array in brute force approach??
@sohamsonwane1534
@sohamsonwane1534 6 ай бұрын
meri tarf se ik papii supper good explanation
@OrderEmperor
@OrderEmperor 6 ай бұрын
🏳️‍🌈
@m1stnoob201
@m1stnoob201 Ай бұрын
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 ?
@RAHULSINGH-cd6gl
@RAHULSINGH-cd6gl 6 ай бұрын
On which topic you will be making your next playlist??
@RituSingh-ne1mk
@RituSingh-ne1mk 7 ай бұрын
Understood!
@NARUTOUZUMAKI-bk4nx
@NARUTOUZUMAKI-bk4nx 6 ай бұрын
Understoood
@atulwadhwa192
@atulwadhwa192 5 ай бұрын
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 3 ай бұрын
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.
@VibhaJamadagni-hz6ck
@VibhaJamadagni-hz6ck Ай бұрын
understood
@dewanandkumar8589
@dewanandkumar8589 2 ай бұрын
Understood
@ArpanChakraborty-do6yz
@ArpanChakraborty-do6yz 4 ай бұрын
Awesome 😎 17:36
@cenacr007
@cenacr007 3 ай бұрын
I couldn't find this question in the a2z playlist.
@ashishpradhan6250
@ashishpradhan6250 Ай бұрын
Nyc
@codeman3828
@codeman3828 5 ай бұрын
Undertsood
@atulwadhwa192
@atulwadhwa192 5 ай бұрын
8:15 Can anyone tell in which video dummy node concrpt is explained by him😅
@dayashankarlakhotia4943
@dayashankarlakhotia4943 7 ай бұрын
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
@Adarsh_agrahari
@Adarsh_agrahari 6 ай бұрын
Done and dusted😅
@musabahmed567
@musabahmed567 4 ай бұрын
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.
@gulugulu-pw2ds
@gulugulu-pw2ds 3 ай бұрын
ACTUALLY ITS LIKE VARIABLE DECLARATION .
@aneeketvispute5063
@aneeketvispute5063 4 күн бұрын
we are not creating a new node we are just declaring it like a temp node
@ShivaMahajan07
@ShivaMahajan07 5 ай бұрын
God or what
@user-gk4zy6bk7l
@user-gk4zy6bk7l 2 ай бұрын
god
@nashratjahan9371
@nashratjahan9371 6 ай бұрын
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 6 ай бұрын
No need for while loop , see the video 11:40
@md.ualiurrahmanrahat2400
@md.ualiurrahmanrahat2400 6 ай бұрын
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 5 ай бұрын
Wait what 😂 he did solved that with if else. Watch it completely before commenting.
@rahulhembram4519
@rahulhembram4519 6 ай бұрын
UnderStood
@aayushgakhar3525
@aayushgakhar3525 3 ай бұрын
free(dummy node):
@cenacr007
@cenacr007 3 ай бұрын
us
@rahulmandal4007
@rahulmandal4007 Ай бұрын
where the hell is the dummy node concept been spending hours to find but couldn't find it Someone plz pin it
@akshitrajputhere
@akshitrajputhere Ай бұрын
mila?
@chinmayraichur8984
@chinmayraichur8984 5 ай бұрын
Understood!
@himanshidafouty347
@himanshidafouty347 Ай бұрын
Understood
L24. Flattening a LinkedList | Multiple Approaches with Dry Run
32:58
take U forward
Рет қаралды 43 М.
L21. Reverse Nodes in K Group Size of LinkedList
24:31
take U forward
Рет қаралды 69 М.
Heartwarming Unity at School Event #shorts
00:19
Fabiosa Stories
Рет қаралды 25 МЛН
Я обещал подарить ему самокат!
01:00
Vlad Samokatchik
Рет қаралды 9 МЛН
Schoolboy - Часть 2
00:12
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 4,5 МЛН
Merge Two Sorted Lists - Leetcode 21 - Python
6:16
NeetCode
Рет қаралды 342 М.
Fastest Way to Learn ANY Programming Language: 80-20 rule
8:24
Sahil & Sarra
Рет қаралды 807 М.
L10. Check if a LinkedList is Palindrome or Not | Multiple Approaches
20:02
L22. Rotate a LinkedList
12:10
take U forward
Рет қаралды 51 М.