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.💯💯
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..
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 😁
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.
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!
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 ❤
Amazing job explaining step by step in very detail i read lots of article and watched other TH-cam, but your explanation is owesome!!!, Thank you so much, before merge sort algorithm was very intimidating, but you made it sounds so easy. Thanks a lot again! I am glad I found your channel.
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.
Really appreciate your work ❤❤❤ Actually i confused in this topic from last week and now i got it after watching this super lecture on merge sort Dry run is part best for understanding the concept of merge sort and thank you so much ❤️
From all the TH-cam 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!!!!!
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"
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)
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..
Shocked to see that the time of completing the recording is 3:20 AM.. It shows your unwavering dedication.. hatsoff to you striver!! you are an inspiration. Understood the concept very well!!
understood! When you get to quicksort please try to cover other related application like kth smallest/largest using quickselect and median in unsorted array in linear time
@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
#Free Education For All......... # Bhishma Pitamah of DSA...You could have earned in lacs by putting it as paid couses on udamey or any other elaerning portals, but you decided to make it free...it requires a greate sacrifice and a feeling of giving back to community, there might be very few peope in world who does this...."विद्या का दान ही सर्वोत्तम दान होता है" Hats Off to you man, Salute from 10+ yrs exp guy from BLR, India....
Implementation code of Merge Sort algorithm in Java : class Solution { public static void merge(int[]nums,int low,int mid,int high){ int left=low,right=mid+1; Listli = new ArrayList(); while(left
For example if the divided array is 1,3 with index 3 and 4... after further division we get two array 1 and 3 . Now we have to sort and then merge and then store in temporary array, whose indexing starts from 0 BUT the original arrays index starts from 3 then 4... that is why we do temp[i-low] to make the index 0 for accessing the 0th element of temp...... Hope you understand.
Because this loop will be recursively called for several times and for each time, the value of low will change. If this loop would have ran only 1 time (i.e. if this loop was inside a non-recursive function), then your logic would have worked. But i am also unable to get how he came up with this logic of (i-low). He forgot to tell the intuition behind it.
See 5 4 3 2 1 Here it will broken as 5 4 3 and 2 1 Then 5 4 3 will be broken as 5 4 and 3 Here low will be 0 so there will be no problem we will copy temp element into the vector but for 2 1 the low I'll be 3 and there in temp vector will have elements in 0 and 1 so to copy them we subtract it will low so that we can access the temp elements at starting indexes
for(int i = low; i < high; i++) { arr[i] = temp.get(i - low); } while copying the temp array to original array why we are subtracting low from i, can't we directly write i ?
The subtraction of low from i is necessary because temp is a smaller array that starts at index 0, whereas arr is the original array that might start at a higher index low. Here’s the breakdown: i is an index in the original array arr, which ranges from low to high - 1. temp.get(i - low) is accessing the corresponding index in the temp array, which starts from 0. If you directly use i without subtracting low, you would try to access elements from temp at an incorrect index, leading to an out-of-bounds error or incorrect copying. this is the answer given by gpt
I am just looking for this type of explanation but no one describes like you. At last you described it in part by part thanks a lot brother. I am a big fa of yours ❤❤
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.
TBH This is my first comment on any study youtube channel ..and i genuinely appreciate this man's effort from bottom of my heart ..whatttaaa explanation ..straight into the head..thankss striver bhaiya 💌💌
Raj bhaiya, you are literally phenomenal. In this era of recession, you're the sun of hope. So no more excuses just strive every single day to become better.
After Watching Recursion Videos. In sorting once concept is know, i am able to write the structure with code on my own. MAy Be paper work is playing the major role. Every video is full of content with zero to hero. Its really great🚀🚀🚀🚀🚀
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.
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
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
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.
Hats off to you bro after i seeing uhr dedication i just felt like a loser coz if uh can shoot a video at 3 am then we only need to understand the DSA like I don't know what I'm telling but just salute uh man like uh r the man that everyone should take inspiration from uh love uh from odisha Cuttack ❤❤
Thanks for the amazing lecture sir. I've been struggling with consistency for so long. So from now on I'll comment on everything I learn. Trying to get a strong hold of dsa before the intern season starts officially.
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..
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
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
❤
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.
great explanation not one other video on TH-cam is as in-depth for the actual understanding of how it works
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?
I wrote the code at first attempt after your explanation ..........thank you so much..
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 😂😂
@@iamnoob7593 🤣🤣🤣🤣🤣🤣
Not a single channel explained this important part(i.e. dry run) : 25:01 to 32:38, thank's man ❤
Striver teaching how to code is just like a story. It really seems so easy to understand 😊
The title "STRIVER" for a reason!!✅
Amazing job explaining step by step in very detail i read lots of article and watched other TH-cam, but your explanation is owesome!!!, Thank you so much, before merge sort algorithm was very intimidating, but you made it sounds so easy. Thanks a lot again! I am glad I found your channel.
Before I use to feel merge sort very difficult but after watching this video, I understood it very clearly. Thank you Striver.
This is called content 🤓✨
This level of clarity would have never been possible without ur video. Your energy of teaching any topic is what makes it more interesting. 🤟
Thank you so much for the amazing explanation🙏.I understood the algorithm perfectly only because of this video.
Thanks Striver, I 'understood' it perfectly! This channel has the potential to become huge with content like this.
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
You are the real hero .. providing such a beautiful content in free of cost. thanks a lot bro.
This was the best explanation for Merge Sort on TH-cam! Thanks
Fr
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
best merge sort explanation on TH-cam ever I'll never forget that thanks bhaiyya!
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.
Really appreciate your work ❤❤❤
Actually i confused in this topic from last week and now i got it after watching this super lecture on merge sort
Dry run is part best for understanding the concept of merge sort and thank you so much ❤️
As expected, Striver's Top notch explanation made Merge sort crystal clear. UNDERSTOOD!! thankyou striver for all the content
From all the TH-cam 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!!!!!
I hope you realize how much value you are creating. It's much more than you think. Thanks a lot!!
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"
Understood! Super amazing explanation as always!! Thank you for your great effort even in the midnight !!!
Wow didn't know this was a 50 minute video!! Never made me look at the time ❤❤❤ this is the best video on merge sort❤ thank you very much 😄
44:2 - "I write codes in one go", the confidence i want
Kya explain kiya hai bro !! like wtf pure yt pe itna acha explanation nai mila meko. Hats off to you my man.
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 ?
Great explanation sir, i didn't understand this concept from love babbar sir so i came here and got it ❤❤❤
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..
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??
@@utkarshsingh5652 bro did u understand i-low concept?
can you explain i-low logic please, I can't get that? low would always be 0, I don't understand the point, although not doing this, does give an error
how is bro so good at explaining, smb give this man an award
Bhaiya please make videos on oops concepts.... The only thing missing from your placement series 🥲
Yes sir please
One of the best explanations I have ever seen on TH-cam 🛐
The Best video avliable for Merge sort on internet . Tysm Striver Understood everything
The best explanation on merge sort! I had a confusion while backtracking, which has been sorted out now.
Understood!! Best Explanation ever🙌🙌🙌🙌 #Striver Aka
Shocked to see that the time of completing the recording is 3:20 AM.. It shows your unwavering dedication.. hatsoff to you striver!! you are an inspiration. Understood the concept very well!!
understood! When you get to quicksort please try to cover other related application like kth smallest/largest using quickselect and median in unsorted array in linear time
11:44 I've studied this algorithm several times, but the clarity I gained from Striver Bhaiya is unmatched. Thank you sincerely, Bhaiya. ❤
just mind blowing explanation .
@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
why did we use temp [ i-low ] while storing the temp values in original array
same question please answer
To make it start from 0 index ,bcz temp is storing from 0 index
Bro only ' i ' is also running...
just use arr[i]=temp[i]
#Free Education For All......... # Bhishma Pitamah of DSA...You could have earned in lacs by putting it as paid couses on udamey or any other elaerning portals, but you decided to make it free...it requires a greate sacrifice and a feeling of giving back to community, there might be very few peope in world who does this...."विद्या का दान ही सर्वोत्तम दान होता है" Hats Off to you man, Salute from 10+ yrs exp guy from BLR, India....
#striver best merge sort video i ever watched. It clears my all doubt points
Probably the best video available on Merge Sort Ever. Goated.
Implementation code of Merge Sort algorithm in Java :
class Solution {
public static void merge(int[]nums,int low,int mid,int high){
int left=low,right=mid+1;
Listli = new ArrayList();
while(left
nums[i] = li.get(i-low);
why are we doing this?
nums[i] = li.get(i) will this not wokr?
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❤❤🔥🔥👍
Please make the videos faster...sir please please please....very less time is there for our placements.....my humble request sir😭😭😭😭😭🙏🙏🙏🙏🙏🙏🙏🙏🙏
You don't understand if he makes videos faster. Just watch the video in 2x speed
Hats off to you man, great explanation. I didnt get this type of explanation for this algorithm all over th youtube, specially the dry run.
Striver audio got muted please check it
kuch kuch aata tha lekin video dekh ke accha se ho gya sab clear... Thanks, bhaiya!!!😊
why use temp[i=low] and not temp[i] .
For example if the divided array is 1,3 with index 3 and 4... after further division we get two array 1 and 3 . Now we have to sort and then merge and then store in temporary array, whose indexing starts from 0 BUT the original arrays index starts from 3 then 4... that is why we do temp[i-low] to make the index 0 for accessing the 0th element of temp......
Hope you understand.
Bro thank you for all the HARDWORK you've done to make this so easy for us. T_T
Will you keep next video or not??.. 14days it's been
Hats off to u bro ❤ as you are recording the video at 3:28 am and not charging a single rupee . We love your dedication
@39:52 why can we write temp[i] directly instead of i-low when it only depends on the value of i
same problem bro ,i cant understand it from past 3 days
Same question 💀💀
Because this loop will be recursively called for several times and for each time, the value of low will change. If this loop would have ran only 1 time (i.e. if this loop was inside a non-recursive function), then your logic would have worked.
But i am also unable to get how he came up with this logic of (i-low). He forgot to tell the intuition behind it.
@@rohandhalpe9084bro did you understand it now, please help...
The amount of energy and effort you put in this is amazing
Why are we doing
𝗮𝗿𝗿[ 𝗶 ] = 𝘁𝗲𝗺𝗽[ 𝗶 - 𝗹𝗼𝘄 ] Instead of
𝗮𝗿𝗿[ 𝗶 ] = 𝘁𝗲𝗺𝗽[ 𝗶 ]
if u found explanation please explain
See 5 4 3 2 1
Here it will broken as 5 4 3 and 2 1
Then 5 4 3 will be broken as 5 4 and 3
Here low will be 0 so there will be no problem we will copy temp element into the vector but for 2 1 the low I'll be 3 and there in temp vector will have elements in 0 and 1 so to copy them we subtract it will low so that we can access the temp elements at starting indexes
because the starting value of i is "low" and we need to start from zero in temp i.e, temp[0]
good quality and very important for placement course you have made.
for(int i = low; i < high; i++) {
arr[i] = temp.get(i - low);
}
while copying the temp array to original array why we are subtracting low from i, can't we directly write i ?
did you got the answer?
The subtraction of low from i is necessary because temp is a smaller array that starts at index 0, whereas arr is the original array that might start at a higher index low.
Here’s the breakdown:
i is an index in the original array arr, which ranges from low to high - 1.
temp.get(i - low) is accessing the corresponding index in the temp array, which starts from 0.
If you directly use i without subtracting low, you would try to access elements from temp at an incorrect index, leading to an out-of-bounds error or incorrect copying. this is the answer given by gpt
I am just looking for this type of explanation but no one describes like you. At last you described it in part by part thanks a lot brother. I am a big fa of yours ❤❤
at 43:49 line number 28 why arr[i]=temp[i-low] ; why (i-low)? why cant we write simply i itself ??
same doubt
Before starting this dsa course ,i felt merge sort is very difficult but striver explained it very clearly ..Thank you Striver 😍
Omg 16days per 1video..omg 😱😳 bro..pls think of us..we here are waiting for your videos faster and eager #striver..i think you are consistent 😓😓😓
I haven’t seen anyone making such
in depth videos 😮. You are doing a great job striver ❤
#striver pls make videos faster bhai 😭
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.
Best video, clears all the concept😊😊
non other youtubers has such a type of dedication hats off
TBH This is my first comment on any study youtube channel ..and i genuinely appreciate this man's effort from bottom of my heart ..whatttaaa explanation ..straight into the head..thankss striver bhaiya 💌💌
u just taugh this algorithm in the most convenient pattern.. i m just too impressed from ur teaching skill sir... thank you soo much❤ Gol bless u
Great lecture. Slightly different implementation of mergeSort in python.
def merge(a1,a2):
res = []
l,r = 0,0
while(l
Raj bhaiya, you are literally phenomenal. In this era of recession, you're the sun of hope. So no more excuses just strive every single day to become better.
What an legit Explaination❤️❤️❤️❤️
I was not understanding that recursive calls....searched a lot for it but no one explained the way you do...tysm😊
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 !
More than 500k views for this video. Imagine the impact this guy is making in the DSA community.
Thankyou for your efforts!! I have never enjoyed learning DSA before the way I enjoy it through your lectures
After Watching Recursion Videos.
In sorting once concept is know, i am able to write the structure with code on my own.
MAy Be paper work is playing the major role.
Every video is full of content with zero to hero. Its really great🚀🚀🚀🚀🚀
Waah bhai thank you i watched a lot of videos of mergesort but no one had explained like u bro❤
watching ur for first time and my mind blown by ur explanation ....really great work..hats off to u
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.
What an explainaiton.lIterally Hats off striver..KEEP CREATING KEEP MOTIVATING
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
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
I think he would be a game changer of my life..... Great Explanation man!
Not just teaching skills but your dedication - recording videos early morning is appreciated
bhai inki ya lovebabar kiska dekhu ma
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.
Hats off to you bro after i seeing uhr dedication i just felt like a loser coz if uh can shoot a video at 3 am then we only need to understand the DSA like I don't know what I'm telling but just salute uh man like uh r the man that everyone should take inspiration from uh love uh from odisha Cuttack ❤❤
I tried understanding merge sort from love babbar and Apna college. But strivers dry run made me understand it clearly.
Thanks for the amazing lecture sir. I've been struggling with consistency for so long. So from now on I'll comment on everything I learn. Trying to get a strong hold of dsa before the intern season starts officially.
I have understand this concept in easy way please make videos for this bases only rqs for sharing her knowledge
i have already watched 20 videos about this sorting, and your are the best!!!!!!!!!! thanks!!!)))