Learn Merge Sort in 13 minutes 🔪

Поділитися
Вставка
  • Опубліковано 11 лип 2021
  • Merge sort algorithm tutorial example explained
    #merge #sort #algorithm
    // merge sort = recursively divide array in 2, sort, re-combine
    // run-time complexity = O(n Log n)
    // space complexity = O(n)
    music credits 🎼:
    ===========================================================
    Title: Wallflowers
    Artist: Bad Snacks
    Link: • bad snacks: UA-cam Au...
    ===========================================================
  • Наука та технологія

КОМЕНТАРІ • 233

  • @BroCodez
    @BroCodez  3 роки тому +364

    This video took me THREE WEEKS to produce! Ya'll better smash that like button for me! lol
    public class Main{

    public static void main(String args[])
    {
    // merge sort = recursively divide array in 2, sort, re-combine
    // run-time complexity = O(n Log n)
    // space complexity = O(n)

    int[] array = {8, 2, 5, 3, 4, 7, 6, 1};

    mergeSort(array);

    for(int i = 0; i < array.length; i++){
    System.out.print(array[i]+ " ");
    }
    }
    private static void mergeSort(int[] array) {

    int length = array.length;
    if (length

    • @syllight9053
      @syllight9053 3 роки тому +40

      Don't worry bro, I smashed the like button, plus I contacted the president to set a direct nuclear launch to the like and subscribe button as well!

    • @BroCodez
      @BroCodez  3 роки тому +18

      @@syllight9053 Thank you Syllight!

    • @immortalbotyt1428
      @immortalbotyt1428 3 роки тому +1

      I already did my big bro :D If we both belonged to only 1 family u would be my bigger bro :D

    • @aditya_asundi
      @aditya_asundi 3 роки тому

      3 weeks making this *AND THERE'S A DISLIKE????*

    • @roysaka4475
      @roysaka4475 3 роки тому

      Hi bro plsae reques Tutorial Python AndroidHelper. Music, recorder, voice mix, microfon. Call phone, game, calculator, google voice recorder, and others..
      🙏🙏🙏🙏🙏🙏 Plsee

  • @mayawhocodes3092
    @mayawhocodes3092 2 роки тому +287

    The way you broke this down into simple terms with visuals and everything, amazing. I'm not a bro, but I do code. And this was lit. Thank you.

  • @coltonbailey8873
    @coltonbailey8873 3 роки тому +61

    You are single-handedly teaching me programming/computer science. Thank you. Never change your teaching structure, because this method works really well.

  • @Jathamus
    @Jathamus 2 роки тому +18

    I knew when I saw "Bro Code" it would be a beautifully simple video.
    What you did that the other videos I watched failed to do was walk through the sort / merge in the order that it would actually happen.
    The other videos were doing it by rows and not the actual order that it happens in. Thank you ! That is what made it click for me.
    I am now subscribed !

  • @jorgemedina8497
    @jorgemedina8497 2 місяці тому +2

    This is the best video I found on all youtube which explains Merge Sort properly. This video is the definition of Quality Content.

  • @kingipra
    @kingipra Рік тому +4

    Best explanation I've seen so far. The rundown at the beginning really helps. Thank you

  • @smokinginthefishroom
    @smokinginthefishroom Рік тому +2

    The best merge sort explanation on UA-cam. Watched like 5 other videos but only this explained how the merge part of merge sort actually works! Liked and subscribed.

  • @raywei1701
    @raywei1701 9 місяців тому +2

    So clear. my professor did not have enough time to go over this in class. Now I understand everything about merge sort.

  • @nyasha_keith_matevengwe
    @nyasha_keith_matevengwe 2 роки тому +7

    You are a great tutor sir, I appreciate, I was failing to understand this all along, but just because of your video, I feel confident enough

  • @nyankiku5863
    @nyankiku5863 Рік тому +3

    You made mergeSort look so simple and easy, thank you so much!

  • @GamerOverThere
    @GamerOverThere 10 місяців тому +11

    Bro, you are a legend. My professor went over merge sort for 1 1/2, and I was left confused. I watched a Harvard lecture video on it, still confused. Asked chatGPT about individual components (not to cheat but to have it explain each step to me, I want to understand this) and it was spewing nonsense. But your video made it finally click. Thanks bro! Liked and subscribed

  • @paulodasilvasa9884
    @paulodasilvasa9884 8 місяців тому

    Thank you man!!! Finally I have found the best explanation of merge sort! You really helped us a lot.
    I've alredy smashed the like button, you deserve it bro!!!

  • @lingjosh6801
    @lingjosh6801 3 роки тому +1

    Clearly explanation and demonstration with merge sort, great work!!!
    Can,t wait for more CS videos.

  • @danielebbersmeyer5087
    @danielebbersmeyer5087 4 місяці тому

    Probably the best video i've seen so far to explain Mergesort, i think i finally got it!

  • @NH-ij8dz
    @NH-ij8dz 4 місяці тому

    Great video. I needed to implement this in C for a CS class and this video explained it in much clearer and easier to follow way than the so called experts who are being paid 6 figures a year to teach this to me. Ty bro.

  • @murnoth
    @murnoth Рік тому +3

    Trying to make these algorithms with blueprint nodes in UE5, and following along with your code is also helping me translate code jargon into blueprint equivalents. Thank you for sharing

  • @aadv1k
    @aadv1k 5 місяців тому

    Thank you for the beautifully elegant explanation that didn't require the viewer to have a PhD. You are one talented bro. Keep it up!

  • @docjp7427
    @docjp7427 7 місяців тому

    You are the best Bro I never had. 2 years have gone by, but this is still amazing.

  • @user-hi8qt6rq4b
    @user-hi8qt6rq4b Рік тому +2

    Good job! It is really easy to understand the algorithm with this video, thank you

  • @tipster360
    @tipster360 Рік тому

    The best merge sort explanation! Thank you so much.

  • @eniax
    @eniax Рік тому +1

    Best merge sort tutorial I've seen, thank you

  • @nurulafsar3195
    @nurulafsar3195 Рік тому

    Best explanation of merge sort so far!

  • @sanskarsongara2592
    @sanskarsongara2592 3 роки тому +9

    Idk you sounds more confident in recent new videos, keep going homie you still gotta reach more people👍

  • @doogiehowser1124
    @doogiehowser1124 9 місяців тому

    Wow! this is a good tutorial. Thank you very much for taking the time to put it together! Well Done!

  • @zyad6385
    @zyad6385 7 місяців тому +1

    After 2 years this is still very useful i understand everything now .
    even though i don't know how to use java i've just learned c++ but everything is clear now

  • @bhumikajoshi6966
    @bhumikajoshi6966 3 роки тому +3

    it'd be really helpful if you continue this playlist!!!
    thanks in advance

  • @charalamposkatsoukis8694
    @charalamposkatsoukis8694 Рік тому

    top content as always. No one more understandable than Bro! (I hope you doin good on your break!!!)

  • @sprinklepancake
    @sprinklepancake Рік тому

    Thank you!! this was very thorough and clear!!

  • @rizzbod
    @rizzbod Рік тому

    Thanks man! , because of you , i can skip the tough work of learning, hehe, and straight jump into implementing algorithms

  • @quantjet7718
    @quantjet7718 6 місяців тому

    Wow you are one of the best UA-camrs to explain algorithms

  • @DJSaez-ll8or
    @DJSaez-ll8or 2 місяці тому

    Really helpful video, thank you!

  • @neophilosophy1764
    @neophilosophy1764 3 місяці тому

    Nice. Thanks for the video!

  • @kennysoyoye493
    @kennysoyoye493 6 днів тому

    this really helped me understand merge sort. thanksss a lot

  • @mohtasimbillah6560
    @mohtasimbillah6560 2 роки тому

    Really good explanation of merge sort! It helped heaps!

  • @MrWardo2009
    @MrWardo2009 9 місяців тому

    Thank you so much for making this video!

  • @toxiclucien8168
    @toxiclucien8168 2 роки тому

    very helpful video...watching all your sorting videos and learning from it...thanks BRO

  • @arturofuentes2230
    @arturofuentes2230 3 місяці тому

    Great video man, I understood everything so quickly, thank you so much and keep coding bro

  • @vansh9857
    @vansh9857 Рік тому

    You earned a sub! Awesome explanation

  • @hannibalbianchi1466
    @hannibalbianchi1466 3 роки тому +3

    No words can explain my appreciation
    Thank you, sir 🏆🏆🏆🏆

  • @aorusaki
    @aorusaki 9 місяців тому

    Needed this for my interview :))) thank you!

  • @Snowmanver2
    @Snowmanver2 2 роки тому

    a concise and helpful tutorial, thanks Bro!

  • @cadmium4113
    @cadmium4113 3 роки тому

    Started your Java playlist love your tricks to teach... Appreciate from another fellow BRO.

  • @DruzeJosipTito
    @DruzeJosipTito Рік тому

    You just made my computer science assignment a whole lot easier lol. Thank you.

  • @AntiPedophile
    @AntiPedophile Рік тому

    thanks for these videos ,we need them alot

  • @sallaklamhayyen9876
    @sallaklamhayyen9876 3 місяці тому

    great job = thank you so much
    please continue🥰

  • @JazzInATinCan
    @JazzInATinCan Рік тому

    Good video, not too long, not too short. Great job.

  • @quantumtea7394
    @quantumtea7394 3 роки тому

    Thank you for your amazing videos!!!❤️❤️❤️

  • @vinayshenoy9896
    @vinayshenoy9896 Місяць тому

    very well explained, Thank you very much

  • @engineeringmania9125
    @engineeringmania9125 Рік тому

    Thanks man!!! Great video🤗

  • @jamongx1
    @jamongx1 Рік тому

    Thanks for your explain! it's very helpful to understand!

  • @solonton6341
    @solonton6341 2 роки тому

    great work, well explained!

  • @ashutoshswain4050
    @ashutoshswain4050 2 роки тому

    thanks a lot bro this solution and your explanation is awesome:)

  • @Matthew_080
    @Matthew_080 6 місяців тому

    Thanks for explaining merge sort!

  • @brandonkruger9040
    @brandonkruger9040 3 роки тому

    Thanks for another great video bro.

  • @scottzeta3067
    @scottzeta3067 2 роки тому

    Thanks Bro, you are the best!

  • @johnxina7496
    @johnxina7496 5 місяців тому

    amazingly explained

  • @Crystal-gs4gu
    @Crystal-gs4gu Рік тому

    Thank you for saving me from my final test. You are the best teacher

  • @EzraSchroeder
    @EzraSchroeder Рік тому

    WoW! Gorgeous video! Mergesort can be hard to understand. Great, great job!

  • @MikeSieko17
    @MikeSieko17 6 місяців тому

    yo bro thanks bro, great stuff bro from one bro to another bro

  • @sahu_SuMiT
    @sahu_SuMiT 3 місяці тому

    awesome, as always....

  • @radicalsaled5756
    @radicalsaled5756 Рік тому +1

    nice job, simple explanation of a long algorithm

  • @josy7
    @josy7 7 місяців тому

    Thanks for the content !

  • @hoanganhnguyen3438
    @hoanganhnguyen3438 4 місяці тому

    omg, I love the music. Good stuffs brah =)))))))))))))

  • @Assassin274
    @Assassin274 14 днів тому

    This was amazing and simple

  • @greenachos372
    @greenachos372 3 роки тому

    Thanks for the informative video

  • @ironmonkey1990
    @ironmonkey1990 Місяць тому

    Thank you !

  • @MeditateRelaxEtcetera
    @MeditateRelaxEtcetera 4 місяці тому

    That's terrific! I'm working my way thru your videos. Wish I found your channel earlier.

  • @AN-rz7bs
    @AN-rz7bs 8 місяців тому

    Thanks, this video really helped me!

  • @mike-fl9xi
    @mike-fl9xi Рік тому

    gg bro. super helpful, nice break down

  • @09FT9
    @09FT9 2 роки тому +1

    If you ever publish a book, I'd be the first one to buy it. Excellent work, Bro. 🙏

  • @BrunoHenrique-oe5hb
    @BrunoHenrique-oe5hb 2 дні тому

    Bro, youre helping me through college. I appreciate it

  • @juanivillanueva7873
    @juanivillanueva7873 Рік тому

    You are a better teacher than my dsa ones!

  • @danilohonda3078
    @danilohonda3078 8 місяців тому

    thanks for the class!!!!

  • @andrewchen861
    @andrewchen861 Рік тому

    Great video! Now I understand it :)

  • @valioprea9796
    @valioprea9796 Рік тому +12

    First of all I just wanted to let you know that thanks to your java section I landed a job as a java developer.
    So ...from the bottom of my heart, thank you, keep up the good work!
    On the other hand, a question for this video: what if the array has an odd length ?

  • @sanjusaju4049
    @sanjusaju4049 Рік тому

    The best video ever .....love u man....

  • @ianvensonbolanio3327
    @ianvensonbolanio3327 Рік тому

    Thankyouuuuusomuch, your video really helps our group "MEMANG".

  • @childishpumpino6751
    @childishpumpino6751 11 місяців тому

    Thank you brother!!!

  • @leoniaklebanov2502
    @leoniaklebanov2502 2 роки тому +1

    Awesome and simple

  • @carl4416
    @carl4416 6 місяців тому

    Thanks!

  • @bryanswiger5888
    @bryanswiger5888 Рік тому

    Like button smashed..... thanks bro

  • @Bromon655
    @Bromon655 4 місяці тому +2

    Recursive algorithms are the bane of my existence.

  • @esmailalmoshki
    @esmailalmoshki Рік тому +1

    شغل جامد يسطى

  • @alaasefa1118
    @alaasefa1118 Рік тому

    this the most helpful channel thank u a lot🥰🥰

  • @rabiizahir2885
    @rabiizahir2885 Рік тому

    Great video. Thanks

  • @ernestselman3955
    @ernestselman3955 7 місяців тому +1

    Hey Bro Code, thanks for the video. It really helped me learn MergeSort. I have a question. In your implementation, would the memory requirements be nlog(n) or n? Since you are creating copies of the arrays as you go down recursively, that would be adding to the memory. If I make the mergeSort method by passing a reference of the original array and indexes representing the start and end of left and right subarrays, then only create the required copies in the merge method before backtracking, wouldn't the maximum memory used be the last step where we would have copies of the entire original array and therefore memory utilization would be 2n or just n?

  • @lokszeto6627
    @lokszeto6627 Рік тому

    amazing!

  • @wmd5645
    @wmd5645 2 роки тому

    nice. very nice. If you didnt work as a sw engineer, my professors were really as bad as i knew they were. good job.

  • @Ray101SPAS
    @Ray101SPAS Рік тому

    Nice explanation. Now it does not seem so complicated.

  • @one111won
    @one111won Рік тому

    legendary explanation

  • @greeneye360k
    @greeneye360k Місяць тому

    best explanation

  • @fernandofigueroa5332
    @fernandofigueroa5332 3 роки тому

    thanks for the video :)

  • @adzamsuleik5604
    @adzamsuleik5604 2 роки тому

    Thank you bro💓

  • @harsinghsekhon5935
    @harsinghsekhon5935 10 місяців тому

    Thank you

  • @dangerbirb4981
    @dangerbirb4981 2 місяці тому

    I like your taste in music :D

  • @jaredshaw2967
    @jaredshaw2967 Рік тому

    awesome explanation bro

  • @victorrezende6002
    @victorrezende6002 9 місяців тому

    Nice class

  • @dylannguyen5154
    @dylannguyen5154 6 місяців тому

    Lifesaver.

  • @simon3431
    @simon3431 3 роки тому

    thank you very much

  • @cagataysen31
    @cagataysen31 Місяць тому

    How can we write down return to the void method? Is it making something like break? Thanks indeed.