Merge Sort | Algorithm | Pseudocode | Dry Run | Code | Strivers A2Z DSA Course
Vložit
- čas přidán 8. 07. 2024
- Problem Link: bit.ly/3DN7ccC
Full Course With Notes: takeuforward.org/strivers-a2z...
Notes/C++/Java/Python Codes: takeuforward.org/data-structu...
You can follow me across social media, all my handles are below:
Linkedin/Instagram/Telegram: linktr.ee/takeUforward
00:00 - MERGE SORT - O(N log N)
1:16 - What is Merge sort
3:00- Algorithm
17:15 - approach
20:34 - pseudo code
25:00 - dry run on divide (pseudo code breakdown)
32:42 - approach of merge
33:46 - pseudo code of merge
40:33 - Code
44:10 - Time complexity analysis
48:05 - Space complexity analysis
Let's march ahead, and create an unmatchable DSA course! ❤
Can someone please add timestamps, I will add them post-it.
time stamps done bro
Bhai please upload videos asap..😭we from a normal tier 3 college are hoping for your videos...pls don't late
#striver pls make videos faster bhai 😭
#striver pls make videos faster bhai 😭..your content is too gud ...but our placements are going on fastly
Bhaiya please be fast in terms of uploading videos 😭😭😭
inspiration recording at 3 am when he can create content with so much dedication then why can't we learn dsa with same dedication hats off to you man.💯💯
190 + likes to this comment but no sub comments
Lemme fix it
Hare krishna
Hare krishna hare krishna krishna krishna hare hare
Hare rama hare rama rama rama hare hare
Chant this and be happy
@@random-xl3zm 😂😂 thanks dude
@@Akash-xr6we no worries
Jai siya ram😁
just woke up and started doing dsa, and you are recording it at midnight, your efforts are not wasted at all Sir!! Thank you for providing such quality content for free.
same brother.............i was watching the video suddenly at last striver said it's 3.30am and i just felt sham on my self boz he is teaching till night and i don't learn genuinely..
MERGE SORT - O(nlogn) - divide and conquer
1:16 - What is and Why Merge sort
3:00- Divide
5:54- Merge
Pseudo code
17:15 - approach (divide)
20:34 - pseudo code (divide)
25:00 - dry run on divide (pseudo code breakdown)
32:42 - approach (merge)
33:46 - pseudo code (merge)
40:33 - C++ code
44:10 - Time complexity analysis
48:05 - Space complexity analysis
❤
In 4 years of college, when teachers came to copy and paste from their 10year old notes I couldn't gain any interest in DSA and felt stupid and never touched the topic post exam. And everything instantly clicked when I watched this video. Honestly your course is giving me insane confidence already. Hope I can make a change within a year, though it's difficult after doing full-time job but I get my confidence back when i see you making this huge stuff after working same or more hours. Planning to stay consistent! Thanks a lot!
PS: We have the same chair 😁
But why i can't hear his voice
The title "STRIVER" for a reason!!✅
This is called content 🤓✨
Superb explanation, sat for around 4hrs to understand how merge sort is working and then I found this video. Understood clearly within 50mins. Very nice and deep explanation.
Thanks Striver, I 'understood' it perfectly! This channel has the potential to become huge with content like this.
Striver teaching how to code is just like a story. It really seems so easy to understand 😊
I hope you realize how much value you are creating. It's much more than you think. Thanks a lot!!
This level of clarity would have never been possible without ur video. Your energy of teaching any topic is what makes it more interesting. 🤟
In my 4 years of engineering and 7 years of work experience, I finally understood merge sort with recursion. I can finally move ahead and sleep properly😂 Thank you so much. Really appreciated 🙏🙏🙏 Love you bro ❤
🤣
now the question is whether u r going use it or not
@@iamnoob7593 😂😂
Before I use to feel merge sort very difficult but after watching this video, I understood it very clearly. Thank you Striver.
From all the CZcams tutorials, I definitely think that your videos are the best in terms of explanation and easy understanding. Thanks a lot, and please keep it up, I love the content!!!!!
Understood! Super amazing explanation as always!! Thank you for your great effort even in the midnight !!!
As expected, Striver's Top notch explanation made Merge sort crystal clear. UNDERSTOOD!! thankyou striver for all the content
These is the best explanation I have find in my entire dsa life. The best part that I always found in other dsa lectures is the best dry run and how to convert that explanation in code.
ALOT OF THANKS.
And that Time and Space Complexity part is like "Add a feather in a cap"
You are the real hero .. providing such a beautiful content in free of cost. thanks a lot bro.
Thankyou for explaining this very tough algo in a very simple way , now it's just get locked in my mind , all credit goes to you !! Thanks a lot !
best merge sort explanation on CZcams ever I'll never forget that thanks bhaiyya!
It's 3:34 in the AM right now and I'm absolutely loving your videos and implementing them simultaneously! I can't ever thank you enough for the amazing content that you've put out! I have my placement drive starting in approximately 100 days and plan to make the most out of it with the help of your lessons! Dil se thank you bhai! Will update my placement status soon!
So, What's the status bro?
where are u working now?
bro placed?
This was the best explanation for Merge Sort on CZcams! Thanks
Fr
I'm pausing the video in between just to appreciate you, the way you explain things is just awesome man. Keep the good work coming. God bless you.
i have already watched 20 videos about this sorting, and your are the best!!!!!!!!!! thanks!!!)))
The best explanation I have ever come across. From the explanation to the complexity part all things were perfectly explained. Thank you so much sir!!
Your passion for teaching is truly inspiring. Thank you for going above and beyond to help us succeed. Your efforts are greatly appreciated.
Highly Understood !!!!!!!
Dil se thank you bhai! After watching your videos, I don't feel the need to see the code as it's pseudocode & dry run are explained so well that it give me confidence to write the whole code by myself.
non other youtubers has such a type of dedication hats off
44:2 - "I write codes in one go", the confidence i want
The amount of energy and effort you put in this is amazing
The best explanation on merge sort! I had a confusion while backtracking, which has been sorted out now.
Wow, this DSA course is absolutely fantastic! 🚀 The explanations are clear and easy to follow, and the examples provided really helped solidify my understanding. I've been searching for a comprehensive resource like this, and I'm so glad I stumbled upon it. A huge shoutout to the creator for putting together such a valuable learning resource. Kudos! 👏💯 #DSA #TUF
Understood!! Best explanation evr on utube...Thank u Striver
Waah bhai thank you i watched a lot of videos of mergesort but no one had explained like u bro❤
As expected one of the best and up to the point topic explanation 🔥🔥
watching ur for first time and my mind blown by ur explanation ....really great work..hats off to u
A little correction at 24:37
You can't write if(low>=high). It will cross the time limit in some cases. As I'm facing this issue in GFG merge sort problem. Instead use if(low==high)
Ohhh!!! nice
Thanks for pointing this out, I was getting TLE due to this on Leetcode.
but why it is giving TLE ?
I haven’t seen anyone making such
in depth videos 😮. You are doing a great job striver ❤
The efforts taken to make this video must have been insane, because this was frankly explained so well it's honestly brilliant. Thank you for all your efforts. Completing this at 4:47am here.
No compromise on sleep from my side , Body does not listen to emotions
One of the best explanations I have ever seen on CZcams 🛐
I watched this lecture two times and I get everything about merge sort
Thankyou striver bhaiya I started ur atoz dsa playlist 🥳🥳♥️
This course is so much helpful for me, thank you so much for this amazing free course .
Thank you striver for the first time I can code the complete algo of merge sort on my own Thank you💖
Once again, an outstanding video! Thank you for investing so much effort in breaking down the approach, providing clear pseudocode, illustrating with recursion trees, and finally, implementing the solution. Take good care of your health too! I hope that you are at least getting sleep for 7 to 8 hours.
Kya explain kiya hai bro !! like wtf pure yt pe itna acha explanation nai mila meko. Hats off to you my man.
just mind blowing explanation .
Sir you are a Straight up god for these topics, Thanks for this great explanation.
Best merge sort explanation ever!! Thanks a lot.
Hats off for your explanation...
you've made me understood recursion with one video
int mid =(low + high) / 2; might give an integer over flow resulting in a negative index which would throw Array out of Bounds Exception and hence its a good practice to use int mid = low + ((high - low) / 2); or faster way is int mid = (low + high) >>> 1 (For Java) and int mid = ((unsigned int)low + (unsigned int)high)) >> 1 (For CPP) to avoid any kind of overflows..
Cherry on the cake
why in the last we did arr[i] = temp[i-low] and not arr[i]=temp[i
]
@@utkarshsingh5652 Because every time the low is not zero. In deeper recursive calls, low can be anything
@@ksankethkumar7223but we added elements in temp so index might be from 0 to high??
@Raj you are changing the field of programming even the concepts and the visualization which are difficult for the experienced professional by watching your videos feel like it's just a cakewalk. Thanks for the content, keep doing it.
JAVA CODE for the merge Sort Algorithm----- TC--O(n*logn) & SC--O(n)
import java.util.*;
public class Solution {
public static void mergeSort(int[] arr, int n) {
// Write your code here.
ms(arr,0,n-1);
}
public static void ms(int arr[],int low,int high)
{
if(low>=high)
{
return;
}
int mid = (low+high)/2;
ms(arr, low, mid);
ms(arr, mid+1, high);
merge(arr,low,mid,high);
}
public static void merge(int arr[],int low,int mid,int high)
{
int left = low;
int right = mid+1;
java.util.List temp = new ArrayList();
while(left
Just started watching the DSA sheet 3-4 days back and after every video just one word for uh bro wow,superb,amazing❤.Got heart and thankyou soo much for such a amazing and quality content❤.
Legendary striver , simply legendary explaination.
Best merge sort ever but i little bit mad so have to watch it 2-3 times to get properly in my head btw thankyou Striver
Hats off to you for such free content❤
Great explanation sir, i didn't understand this concept from love babbar sir so i came here and got it ❤❤❤
Thanks for the hardwork Striver, you are an inspiration.
How i express your teaching skills
You r amazing!!!
I seen so many videos on merge sort but no one explain like you even my college professor
I thank to myself for finding this amazing playlist.
Thankyou for your efforts!! I have never enjoyed learning DSA before the way I enjoy it through your lectures
how is bro so good at explaining, smb give this man an award
Perfect explanation ❤
Super Super easy explanation!! Thanks for the content👍👍👍
understood by a great teacher ❤
Thankyou STRIVER, I understood the space complexity of the merge Sort.
kuch kuch aata tha lekin video dekh ke accha se ho gya sab clear... Thanks, bhaiya!!!😊
Appreciable, someone suggested that I ought to watch you.
Understood Very much clearly!! Thank you❤
best video for understanding merge sort, when compared to other videos available on
What a session this has been, Love You Striver.
thankyou for your efforts........i am getting the concepts very clearly
Understood!! Best Explanation ever🙌🙌🙌🙌 #Striver Aka
Understood clearly 💯 thank you 💯🔥
your explanation method is awesome as compare to other .
I saw many video in merge sort but I understand only in this video.
thank you sir❤❤🔥🔥👍
dry run part was superb man...🔥🔥
I can understand the whole video bruh very great jus got it rat into my hands in my first yr I am very lucky to find u soon.
Understood!! Loved the explanation!🙌
I have understood everything. Sir thanks to make such a best video.
Amazing ! No dbts at all ...understood without replaying any parts .
You explain the best! Hats Off :)
Understood, most clear explanation
Your are one of the best instructor, youtuber❤
Best Explaination of Merge Sort, Really thank you Striver.
Very good explanation Sir. Thank you so much for your efforts.
you are an absolute legend,love from Bangladesh
incomparable teaching skills.
hatsoff for your dedication striver 🙌
Thanks for this Quality series, lots of respect for you bhaiya!!
Thankyou for the lecture striver
super explaination... thank you bhaiya!!
The explanation is top notch my man.
May god bless you. It was a gem. Respect you Hard work.
so much clearity in explanation
The best explanation ever !
Thank you sir so much for the explaination, i've been try to dry run it and try to understand this from morning, but after watching this video everything has cleared. Hats off to you for your efforts.
Best of All for Merge Sort 👌👌👌👌
This is the best merge sort video I have never seen before Thanks a lot Sir
it took me near about 4 hours to completely understand the sorting technique I am in first year of engineering an average guy hoping that ..... this stuff takes time for beginners
You are awesome , you had clear all my doubt , thanks for this buddy.
May God bless you with Success and good health... This content is Pure Gold ❤️