Merge Sort | Algorithm | Pseudocode | Dry Run | Code | Strivers A2Z DSA Course

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 ก.ย. 2024

ความคิดเห็น • 1K

  • @takeUforward
    @takeUforward  ปีที่แล้ว +197

    Let's march ahead, and create an unmatchable DSA course! ❤
    Can someone please add timestamps, I will add them post-it.

    • @msdarshankirthic9990
      @msdarshankirthic9990 ปีที่แล้ว +4

      time stamps done bro

    • @harshavardhan184
      @harshavardhan184 ปีที่แล้ว +5

      Bhai please upload videos asap..😭we from a normal tier 3 college are hoping for your videos...pls don't late

    • @harshavardhan184
      @harshavardhan184 ปีที่แล้ว +4

      #striver pls make videos faster bhai 😭

    • @harshavardhan184
      @harshavardhan184 ปีที่แล้ว +4

      #striver pls make videos faster bhai 😭..your content is too gud ...but our placements are going on fastly

    • @Shubham-bh1ph
      @Shubham-bh1ph ปีที่แล้ว +3

      Bhaiya please be fast in terms of uploading videos 😭😭😭

  • @Akash-xr6we
    @Akash-xr6we ปีที่แล้ว +594

    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.💯💯

    • @random-xl3zm
      @random-xl3zm 8 หลายเดือนก่อน +6

      190 + likes to this comment but no sub comments
      Lemme fix it

    • @random-xl3zm
      @random-xl3zm 8 หลายเดือนก่อน +13

      Hare krishna

    • @random-xl3zm
      @random-xl3zm 8 หลายเดือนก่อน +19

      Hare krishna hare krishna krishna krishna hare hare
      Hare rama hare rama rama rama hare hare
      Chant this and be happy

    • @Akash-xr6we
      @Akash-xr6we 8 หลายเดือนก่อน +3

      @@random-xl3zm 😂😂 thanks dude

    • @random-xl3zm
      @random-xl3zm 8 หลายเดือนก่อน +10

      @@Akash-xr6we no worries
      Jai siya ram😁

  • @raodevendrasingh
    @raodevendrasingh ปีที่แล้ว +213

    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.

    • @hiteshpanchal5772
      @hiteshpanchal5772 ปีที่แล้ว +18

      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..

  • @expl0itr
    @expl0itr 5 หลายเดือนก่อน +51

    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 😁

  • @msdarshankirthic9990
    @msdarshankirthic9990 ปีที่แล้ว +160

    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

  • @kaizjessani7303
    @kaizjessani7303 ปีที่แล้ว +44

    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 ❤

    • @Vishalkumar-fe9fu
      @Vishalkumar-fe9fu ปีที่แล้ว +1

      🤣

    • @iamnoob7593
      @iamnoob7593 9 หลายเดือนก่อน

      now the question is whether u r going use it or not

    • @kaizjessani7303
      @kaizjessani7303 9 หลายเดือนก่อน

      @@iamnoob7593 😂😂

    • @vivekgautam9766
      @vivekgautam9766 24 วันที่ผ่านมา

      @@iamnoob7593 🤣🤣🤣🤣🤣🤣

  • @saivarun5529
    @saivarun5529 ปีที่แล้ว +33

    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.

  • @darshanakv4946
    @darshanakv4946 5 หลายเดือนก่อน +39

    The title "STRIVER" for a reason!!✅

  • @ishaanrawal9327
    @ishaanrawal9327 ปีที่แล้ว +38

    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!

  • @deveshmanitripathi9419
    @deveshmanitripathi9419 ปีที่แล้ว +19

    Striver teaching how to code is just like a story. It really seems so easy to understand 😊

  • @changed217
    @changed217 ปีที่แล้ว +17

    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.

    • @iamnoob7593
      @iamnoob7593 9 หลายเดือนก่อน +4

      No compromise on sleep from my side , Body does not listen to emotions

  • @amitpatil6244
    @amitpatil6244 ปีที่แล้ว +45

    This is called content 🤓✨

  • @Pooja-we3xs
    @Pooja-we3xs ปีที่แล้ว +11

    Before I use to feel merge sort very difficult but after watching this video, I understood it very clearly. Thank you Striver.

  • @prathamesh_utube
    @prathamesh_utube ปีที่แล้ว +20

    Thanks Striver, I 'understood' it perfectly! This channel has the potential to become huge with content like this.

  • @devanshusangra6294
    @devanshusangra6294 ปีที่แล้ว +12

    44:2 - "I write codes in one go", the confidence i want

  • @payaljain6825
    @payaljain6825 ปีที่แล้ว +7

    This level of clarity would have never been possible without ur video. Your energy of teaching any topic is what makes it more interesting. 🤟

  • @AmanKumar-fe2ez
    @AmanKumar-fe2ez ปีที่แล้ว +9

    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

  • @ksankethkumar7223
    @ksankethkumar7223 ปีที่แล้ว +9

    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..

    • @utkarshsingh5652
      @utkarshsingh5652 11 หลายเดือนก่อน

      why in the last we did arr[i] = temp[i-low] and not arr[i]=temp[i
      ]

    • @ksankethkumar7223
      @ksankethkumar7223 11 หลายเดือนก่อน

      @@utkarshsingh5652 Because every time the low is not zero. In deeper recursive calls, low can be anything

    • @shivangitekriwal3056
      @shivangitekriwal3056 4 หลายเดือนก่อน

      ​@@ksankethkumar7223but we added elements in temp so index might be from 0 to high??

    • @NihalNamdeo
      @NihalNamdeo หลายเดือนก่อน

      ​@@utkarshsingh5652 bro did u understand i-low concept?

    • @NihalNamdeo
      @NihalNamdeo หลายเดือนก่อน

      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

  • @yhbarve
    @yhbarve ปีที่แล้ว +10

    This was the best explanation for Merge Sort on TH-cam! Thanks

  • @MANISHKUMAR-vn1yh
    @MANISHKUMAR-vn1yh ปีที่แล้ว +5

    best merge sort explanation on TH-cam ever I'll never forget that thanks bhaiyya!

  • @pcyvlogs8130
    @pcyvlogs8130 9 หลายเดือนก่อน +3

    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!!!!!

  • @nandanitiwari8098
    @nandanitiwari8098 9 หลายเดือนก่อน +2

    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"

  • @subhamsharma9097
    @subhamsharma9097 ปีที่แล้ว +11

    You are the real hero .. providing such a beautiful content in free of cost. thanks a lot bro.

  • @ritikumaroy
    @ritikumaroy ปีที่แล้ว +13

    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)

    • @venkatgaddam6587
      @venkatgaddam6587 ปีที่แล้ว +2

      Ohhh!!! nice

    • @shriyamverma7833
      @shriyamverma7833 4 หลายเดือนก่อน +1

      Thanks for pointing this out, I was getting TLE due to this on Leetcode.

    • @GOVIND_DWIVEDI
      @GOVIND_DWIVEDI 3 หลายเดือนก่อน

      but why it is giving TLE ?

  • @navneetuppal9753
    @navneetuppal9753 ปีที่แล้ว +4

    As expected, Striver's Top notch explanation made Merge sort crystal clear. UNDERSTOOD!! thankyou striver for all the content

  • @mdfaizanmdfaizan6041
    @mdfaizanmdfaizan6041 3 หลายเดือนก่อน +2

    Great explanation sir, i didn't understand this concept from love babbar sir so i came here and got it ❤❤❤

  • @cinime
    @cinime ปีที่แล้ว +8

    Understood! Super amazing explanation as always!! Thank you for your great effort even in the midnight !!!

  • @rushidesai2836
    @rushidesai2836 19 วันที่ผ่านมา

    More than 500k views for this video. Imagine the impact this guy is making in the DSA community.

  • @varuntanwar6746
    @varuntanwar6746 ปีที่แล้ว +3

    I hope you realize how much value you are creating. It's much more than you think. Thanks a lot!!

  • @mayankyadav1290
    @mayankyadav1290 10 หลายเดือนก่อน +2

    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.

  • @vardhamanbhandari5644
    @vardhamanbhandari5644 ปีที่แล้ว +2

    Understood!! Best Explanation ever🙌🙌🙌🙌 #Striver Aka

  • @ashishsahay1901
    @ashishsahay1901 ปีที่แล้ว +1

    @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

  • @TrendyGamer007
    @TrendyGamer007 ปีที่แล้ว +2

    just mind blowing explanation .

  • @the.ankit.07
    @the.ankit.07 7 วันที่ผ่านมา +1

    I wrote the code at first attempt after your explanation ..........thank you so much..

  • @saurabhkumarsingh9550
    @saurabhkumarsingh9550 ปีที่แล้ว +9

    Bhaiya please make videos on oops concepts.... The only thing missing from your placement series 🥲

  • @shubhamagarwal1434
    @shubhamagarwal1434 หลายเดือนก่อน

    #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....

  • @AdityaKumar-be7hx
    @AdityaKumar-be7hx ปีที่แล้ว +2

    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

  • @meeradhumne4685
    @meeradhumne4685 2 หลายเดือนก่อน +1

    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.

  • @amishaagarwal4847
    @amishaagarwal4847 ปีที่แล้ว +12

    why did we use temp [ i-low ] while storing the temp values in original array

    • @RaghavSharma19201
      @RaghavSharma19201 ปีที่แล้ว +2

      same question please answer

    • @_HarshKumar-hx8cs
      @_HarshKumar-hx8cs ปีที่แล้ว

      To make it start from 0 index ,bcz temp is storing from 0 index

    • @DeepakGupta-rp8ld
      @DeepakGupta-rp8ld ปีที่แล้ว

      Bro only ' i ' is also running...

    • @MAX_RITIK
      @MAX_RITIK 17 วันที่ผ่านมา

      just use arr[i]=temp[i]

  • @nischayagrawalVlogs
    @nischayagrawalVlogs ปีที่แล้ว +1

    Kya explain kiya hai bro !! like wtf pure yt pe itna acha explanation nai mila meko. Hats off to you my man.

  • @Raj10185
    @Raj10185 ปีที่แล้ว +2

    The Best video avliable for Merge sort on internet . Tysm Striver Understood everything

  • @RajeshKumar-x7l5y
    @RajeshKumar-x7l5y หลายเดือนก่อน +1

    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 ❤️

  • @yashhokte1020
    @yashhokte1020 ปีที่แล้ว +7

    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

    • @charuprabha9696
      @charuprabha9696 4 หลายเดือนก่อน

      nums[i] = li.get(i-low);
      why are we doing this?
      nums[i] = li.get(i) will this not wokr?

  • @BhavanaReddy15
    @BhavanaReddy15 2 หลายเดือนก่อน +1

    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 😄

  • @Flash-qr5oh
    @Flash-qr5oh ปีที่แล้ว +6

    @39:52 why can we write temp[i] directly instead of i-low when it only depends on the value of i

    • @rohandhalpe9084
      @rohandhalpe9084 ปีที่แล้ว

      same problem bro ,i cant understand it from past 3 days

    • @rahulbisht7098
      @rahulbisht7098 ปีที่แล้ว

      Same question 💀💀

    • @amansinghal4663
      @amansinghal4663 ปีที่แล้ว +3

      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.

    • @NihalNamdeo
      @NihalNamdeo หลายเดือนก่อน

      ​@@rohandhalpe9084bro did you understand it now, please help...

  • @dishas6328
    @dishas6328 28 วันที่ผ่านมา +1

    Thank you so much for the amazing explanation🙏.I understood the algorithm perfectly only because of this video.

  • @dangerboy_yt7748
    @dangerboy_yt7748 6 หลายเดือนก่อน +3

    Striver audio got muted please check it

  • @sahitid5570
    @sahitid5570 2 หลายเดือนก่อน

    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!!

  • @485_rahulkumar7
    @485_rahulkumar7 ปีที่แล้ว +2

    #striver best merge sort video i ever watched. It clears my all doubt points

  • @ayushiyadav1
    @ayushiyadav1 หลายเดือนก่อน

    11:44 I've studied this algorithm several times, but the clarity I gained from Striver Bhaiya is unmatched. Thank you sincerely, Bhaiya. ❤

  • @viskumdee
    @viskumdee ปีที่แล้ว +5

    at 43:49 line number 28 why arr[i]=temp[i-low] ; why (i-low)? why cant we write simply i itself ??

  • @Vikhyath_Shetty
    @Vikhyath_Shetty 3 หลายเดือนก่อน +1

    The best explanation on merge sort! I had a confusion while backtracking, which has been sorted out now.

  • @harshavardhan184
    @harshavardhan184 ปีที่แล้ว +6

    Please make the videos faster...sir please please please....very less time is there for our placements.....my humble request sir😭😭😭😭😭🙏🙏🙏🙏🙏🙏🙏🙏🙏

    • @Vinayreddy_55
      @Vinayreddy_55 25 วันที่ผ่านมา

      You don't understand if he makes videos faster. Just watch the video in 2x speed

  • @swarnabhkashyap5764
    @swarnabhkashyap5764 9 หลายเดือนก่อน

    Great lecture. Slightly different implementation of mergeSort in python.
    def merge(a1,a2):
    res = []
    l,r = 0,0
    while(l

  • @Vladimir.39665
    @Vladimir.39665 ปีที่แล้ว +3

    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 ?

    • @AmitSharma-nv2oj
      @AmitSharma-nv2oj หลายเดือนก่อน

      did you got the answer?

    • @siddhantsingh3346
      @siddhantsingh3346 14 วันที่ผ่านมา

      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

  • @AryanPatel-wb5tp
    @AryanPatel-wb5tp 9 วันที่ผ่านมา

    great explanation not one other video on TH-cam is as in-depth for the actual understanding of how it works

  • @harshavardhan184
    @harshavardhan184 ปีที่แล้ว +3

    Will you keep next video or not??.. 14days it's been

  • @ahnafadib8774
    @ahnafadib8774 2 หลายเดือนก่อน +1

    how is bro so good at explaining, smb give this man an award

  • @abhinaash4602
    @abhinaash4602 6 หลายเดือนก่อน +6

    why use temp[i=low] and not temp[i] .

    • @prernasharma9722
      @prernasharma9722 28 วันที่ผ่านมา +1

      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.

  • @daaamn6414
    @daaamn6414 2 หลายเดือนก่อน +1

    Bro thank you for all the HARDWORK you've done to make this so easy for us. T_T

  • @me.rishiii
    @me.rishiii ปีที่แล้ว +3

    Why are we doing
    𝗮𝗿𝗿[ 𝗶 ] = 𝘁𝗲𝗺𝗽[ 𝗶 - 𝗹𝗼𝘄 ] Instead of
    𝗮𝗿𝗿[ 𝗶 ] = 𝘁𝗲𝗺𝗽[ 𝗶 ]

    • @friedfire9462
      @friedfire9462 ปีที่แล้ว

      if u found explanation please explain

    • @Bharat_Rider
      @Bharat_Rider ปีที่แล้ว +6

      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

    • @architgupta8840
      @architgupta8840 ปีที่แล้ว

      because the starting value of i is "low" and we need to start from zero in temp i.e, temp[0]

  • @codinglover5251
    @codinglover5251 8 หลายเดือนก่อน +2

    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❤❤🔥🔥👍

  • @harshavardhan184
    @harshavardhan184 ปีที่แล้ว +3

    #striver pls make videos faster bhai 😭

  • @hitensamalia
    @hitensamalia 9 หลายเดือนก่อน +1

    kuch kuch aata tha lekin video dekh ke accha se ho gya sab clear... Thanks, bhaiya!!!😊

  • @harshavardhan184
    @harshavardhan184 ปีที่แล้ว +3

    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 😓😓😓

  • @AshutoshAnand-o5l
    @AshutoshAnand-o5l 4 วันที่ผ่านมา

    What an explainaiton.lIterally Hats off striver..KEEP CREATING KEEP MOTIVATING

  • @ShubhamSharma-zq2xn
    @ShubhamSharma-zq2xn 5 หลายเดือนก่อน

    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.

  • @viploveparsai9881
    @viploveparsai9881 21 วันที่ผ่านมา +1

    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.

  • @janatalari6139
    @janatalari6139 2 หลายเดือนก่อน

    Before starting this dsa course ,i felt merge sort is very difficult but striver explained it very clearly ..Thank you Striver 😍

  • @simran5048
    @simran5048 ปีที่แล้ว +1

    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 !

  • @ArunKumar-vd8zt
    @ArunKumar-vd8zt 5 หลายเดือนก่อน +1

    One of the best explanations I have ever seen on TH-cam 🛐

  • @dumbstonks
    @dumbstonks หลายเดือนก่อน

    Probably the best video available on Merge Sort Ever. Goated.

  • @nagarajmnaiknagaraj1813
    @nagarajmnaiknagaraj1813 4 หลายเดือนก่อน

    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.

  • @RohithVenkatMutyala
    @RohithVenkatMutyala 7 วันที่ผ่านมา

    06:13 Merge sort is an optimized sorting algorithm.
    12:26 Merge Sort is about merging and sorting arrays in a hypothetical manner
    18:39 Merge Sort is an algorithm that divides an array into two halves, sorts them, and then merges them.
    24:52 Merge Sort Algorithm using Recursion
    31:05 Understanding merge sort through pseudocode and dry run
    37:18 Explaining the merge sort algorithm
    43:31 Merging left and right arrays
    49:43 Merge Sort has a time complexity of n*log(n) and a space complexity of n.

  • @bharathsampath8171
    @bharathsampath8171 หลายเดือนก่อน

    those who dint understand why we use i-low the reason is that low is given by user so it should not necessarily be 0 so for example if low is 2 and high is 6 so temp will have elements from 2 to 6 in sorted order so arr[low] should be temp[0] and arr[low+1] should be temp[1] and so on.so to map these we use i-low

  • @thefourhourtalk
    @thefourhourtalk 4 หลายเดือนก่อน

    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

  • @SR09947
    @SR09947 ปีที่แล้ว +1

    Waah bhai thank you i watched a lot of videos of mergesort but no one had explained like u bro❤

  • @vartikamishra2578
    @vartikamishra2578 2 หลายเดือนก่อน +1

    very nice explanation of recursion sir , thankyou soo much sir

  • @tahuraalam7
    @tahuraalam7 2 หลายเดือนก่อน

    I haven’t seen anyone making such
    in depth videos 😮. You are doing a great job striver ❤

  • @premsoni619
    @premsoni619 ปีที่แล้ว +2

    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

  • @Entertainment-fl6ep
    @Entertainment-fl6ep 2 หลายเดือนก่อน

    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 ❤❤

  • @shwetachoudhary9003
    @shwetachoudhary9003 2 หลายเดือนก่อน

    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

  • @AshwinCodes
    @AshwinCodes ปีที่แล้ว +1

    I tried understanding merge sort from love babbar and Apna college. But strivers dry run made me understand it clearly.

  • @Sarjais_Raja
    @Sarjais_Raja 3 หลายเดือนก่อน

    The amount of energy and effort you put in this is amazing

  • @anjalichauragade1486
    @anjalichauragade1486 หลายเดือนก่อน

    I was not understanding that recursive calls....searched a lot for it but no one explained the way you do...tysm😊

  • @mukundmohan4301
    @mukundmohan4301 หลายเดือนก่อน

    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 💌💌

  • @sunitakukreja6700
    @sunitakukreja6700 2 หลายเดือนก่อน +1

    Best video, clears all the concept😊😊

  • @FireGamerz-of6vv
    @FireGamerz-of6vv 7 หลายเดือนก่อน

    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🚀🚀🚀🚀🚀

  • @kshitijsrivastava7849
    @kshitijsrivastava7849 ปีที่แล้ว +1

    watching ur for first time and my mind blown by ur explanation ....really great work..hats off to u

  • @_Kunal_Pawar
    @_Kunal_Pawar 6 หลายเดือนก่อน

    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.

  • @Veeshaljha
    @Veeshaljha 11 หลายเดือนก่อน +1

    Understood So well that now I can give tuitions to my college teachers.

  • @MitaliMaurya-k4x
    @MitaliMaurya-k4x 2 หลายเดือนก่อน

    Thankyou for your efforts!! I have never enjoyed learning DSA before the way I enjoy it through your lectures

  • @studynewthings1727
    @studynewthings1727 ปีที่แล้ว +1

    Thankyou STRIVER, I understood the space complexity of the merge Sort.

  • @RailExpressbyPreetam
    @RailExpressbyPreetam หลายเดือนก่อน +2

    What an legit Explaination❤️❤️❤️❤️

  • @souvikbiswas284
    @souvikbiswas284 หลายเดือนก่อน

    The note section is missing the Python Code, Pasting it here,
    P.S.: The Merge function is a bit different but the concept is Same.
    class Solution:
    def merge(self,arr, l, m, r):
    # code here
    arr1 = arr[l:m]
    arr2 = arr[m: r+1]
    i = j = 0
    while i < len(arr1) or j < len(arr2):
    if j >= len(arr2):
    arr[l+i+j] = arr1[i]
    i += 1
    elif i >= len(arr1):
    arr[l+i+j] = arr2[j]
    j += 1
    elif arr2[j] > arr1[i]:
    arr[l+i+j] = arr1[i]
    i += 1
    else:
    arr[l+i+j] = arr2[j]
    j += 1
    def mergeSort(self,arr, l, r):
    #code here
    if l==r:
    return
    mid = l + (r-l)//2
    self.mergeSort(arr, l, mid)
    self.mergeSort(arr, mid+1, r)
    self.merge(arr, l, mid+1, r)

  • @suyashtripathi1818
    @suyashtripathi1818 2 หลายเดือนก่อน

    How to say I don't know but you're amazing big bro.as...God of coding world... 👌

  • @ekta9145
    @ekta9145 3 หลายเดือนก่อน

    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.

  • @KeshavRaj-w4y
    @KeshavRaj-w4y 5 หลายเดือนก่อน

    non other youtubers has such a type of dedication hats off

  • @factsclub4u
    @factsclub4u 2 หลายเดือนก่อน

    06:13 Merge sort is an optimized sorting algorithm.
    12:26 Merge Sort is about merging and sorting arrays in a hypothetical manner
    18:39 Merge Sort is an algorithm that divides an array into two halves, sorts them, and then merges them.
    24:52 Merge Sort Algorithm using Recursion
    31:05 Understanding merge sort through pseudocode and dry run
    37:18 Explaining the merge sort algorithm
    43:31 Merging left and right arrays
    49:43 Merge Sort has a time complexity of n*log(n) and a space complexity of n.
    Crafted by Merlin AI.

  • @ChandrahasaMutyala
    @ChandrahasaMutyala ปีที่แล้ว

    Not just teaching skills but your dedication - recording videos early morning is appreciated

    • @GaganSingh-zz9el
      @GaganSingh-zz9el 11 หลายเดือนก่อน

      bhai inki ya lovebabar kiska dekhu ma