Learn Merge Sort in 13 minutes 🔪

  Рет қаралды 341,036

Bro Code

Bro Code

Күн бұрын

Пікірлер: 274
@BroCodez
@BroCodez 3 жыл бұрын
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 жыл бұрын
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 жыл бұрын
@@syllight9053 Thank you Syllight!
@immortalbotyt1428
@immortalbotyt1428 3 жыл бұрын
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 жыл бұрын
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.
@sancho608
@sancho608 Жыл бұрын
No. You are a bro now!!
@fsxanas90
@fsxanas90 6 ай бұрын
why the karen vibe tho lmao
@johndavis29209
@johndavis29209 5 ай бұрын
@@fsxanas90 Why anything
@BigSmoke-r9w
@BigSmoke-r9w 4 ай бұрын
You are a bro! 👊
@sabdullahtu-techandunboxin8131
@sabdullahtu-techandunboxin8131 2 ай бұрын
Fr
@coltonbailey8873
@coltonbailey8873 3 жыл бұрын
You are single-handedly teaching me programming/computer science. Thank you. Never change your teaching structure, because this method works really well.
@DopemonRoA
@DopemonRoA 2 жыл бұрын
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 5 ай бұрын
This is the best video I found on all youtube which explains Merge Sort properly. This video is the definition of Quality Content.
@raywei1701
@raywei1701 Жыл бұрын
So clear. my professor did not have enough time to go over this in class. Now I understand everything about merge sort.
@GamerOverThere
@GamerOverThere Жыл бұрын
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
@alirezabayat4337
@alirezabayat4337 Ай бұрын
I wrote this code first time non-recursively, it was a DISASTER, but this is super easy! Thank you!
@kingipra
@kingipra Жыл бұрын
Best explanation I've seen so far. The rundown at the beginning really helps. Thank you
@tsfgh9568
@tsfgh9568 Ай бұрын
We’re passing Oneil’s class with this one 🗣️🗣️🔥
@aadv1k
@aadv1k 9 ай бұрын
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!
@danielebbersmeyer5087
@danielebbersmeyer5087 8 ай бұрын
Probably the best video i've seen so far to explain Mergesort, i think i finally got it!
@Bromon655
@Bromon655 8 ай бұрын
Recursive algorithms are the bane of my existence.
@Nootey33
@Nootey33 3 ай бұрын
I'm on a journey of learning DSA ... I've got to say, you explain things very well! Glad I've stumbled on your channel.
@zyad6385
@zyad6385 11 ай бұрын
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
@nyankiku5863
@nyankiku5863 2 жыл бұрын
You made mergeSort look so simple and easy, thank you so much!
@nyasha_keith_matevengwe
@nyasha_keith_matevengwe 2 жыл бұрын
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
@murnoth
@murnoth 2 жыл бұрын
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
@hannibalbianchi1466
@hannibalbianchi1466 3 жыл бұрын
No words can explain my appreciation Thank you, sir 🏆🏆🏆🏆
@valioprea9796
@valioprea9796 2 жыл бұрын
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 ?
@docjp7427
@docjp7427 11 ай бұрын
You are the best Bro I never had. 2 years have gone by, but this is still amazing.
@quantjet7718
@quantjet7718 10 ай бұрын
Wow you are one of the best KZbinrs to explain algorithms
@nicholasgates9391
@nicholasgates9391 Ай бұрын
Ive never learned a concept so fast, thank you so much!
@StrangerHaha76
@StrangerHaha76 2 ай бұрын
Thank you so much bro. My lecturer in campus and his slides are so confusing and it makes me think merge sort is difficult as hell. However your video explained it's so simple so i can understand it better and it's not that hard
@tipster360
@tipster360 Жыл бұрын
The best merge sort explanation! Thank you so much.
@daviduntalan
@daviduntalan 2 ай бұрын
this helps me understand how the algorithm works, thank you bro for this detailed explanation. ^_^
@alperenunuvar
@alperenunuvar Ай бұрын
this video is one of the best one that I've ever watched
@bhumikajoshi6966
@bhumikajoshi6966 3 жыл бұрын
it'd be really helpful if you continue this playlist!!! thanks in advance
@paulodasilvasa9884
@paulodasilvasa9884 Жыл бұрын
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 жыл бұрын
Clearly explanation and demonstration with merge sort, great work!!! Can,t wait for more CS videos.
@РашидМирзе
@РашидМирзе Жыл бұрын
Good job! It is really easy to understand the algorithm with this video, thank you
@eniax
@eniax Жыл бұрын
Best merge sort tutorial I've seen, thank you
@smokinginthefishroom
@smokinginthefishroom Жыл бұрын
The best merge sort explanation on KZbin. Watched like 5 other videos but only this explained how the merge part of merge sort actually works! Liked and subscribed.
@BrunoHenrique-oe5hb
@BrunoHenrique-oe5hb 3 ай бұрын
Bro, youre helping me through college. I appreciate it
@nurulafsar3195
@nurulafsar3195 Жыл бұрын
Best explanation of merge sort so far!
@radicalsaled5756
@radicalsaled5756 Жыл бұрын
nice job, simple explanation of a long algorithm
@Crystal-gs4gu
@Crystal-gs4gu Жыл бұрын
Thank you for saving me from my final test. You are the best teacher
@ianvensonbolanio3327
@ianvensonbolanio3327 Жыл бұрын
Thankyouuuuusomuch, your video really helps our group "MEMANG".
@sanskarsongara2592
@sanskarsongara2592 3 жыл бұрын
Idk you sounds more confident in recent new videos, keep going homie you still gotta reach more people👍
@Marzex1x
@Marzex1x 2 ай бұрын
how i actually understood everything just from the visualisation in the beggining wrote the whole program by myself and then watched the rest of the video and my logic was 100% correct haahha only thing i did differently in the merge function is that i just made 1 for loop with 1 if statement and 1 else statement.
@DruzeJosipTito
@DruzeJosipTito Жыл бұрын
You just made my computer science assignment a whole lot easier lol. Thank you.
@09FT9
@09FT9 2 жыл бұрын
If you ever publish a book, I'd be the first one to buy it. Excellent work, Bro. 🙏
@taido4883
@taido4883 10 ай бұрын
Thank you Bro! However, I still have trouble understanding the recursive part mergeSort(leftArray); mergeSort(rightArray); merge(leftArray, rightArray, array); The mergeSort function continuously divides an array into 2 halves. By the time we call merge(leftArray, rightArray, array), is array still the original array? However, leftArray and rightArray are no longer half of the original array because we call mergeSort(leftArray) and mergeSort(rightArray) before calling merge(leftArray, rightArray, array).
@joimeecajandab1438
@joimeecajandab1438 10 ай бұрын
me tooo.. this breaks my brain
@LizyAd
@LizyAd Ай бұрын
Don't ever stop doing what you're doing. You're the GOAT
@rejected4760
@rejected4760 2 ай бұрын
Isn't the space complexes nlogn because you are creating double the number of arrays each step that combined add up to the original array each step. And since you are splitting the array in half until they can't be split, you split them log base 2 (n) times. So space must be log n times n. Edit: space completely really is O(n) since the recursion works in a depth first way. So you are only using O(n) space at the same time.
@rizzbod
@rizzbod Жыл бұрын
Thanks man! , because of you , i can skip the tough work of learning, hehe, and straight jump into implementing algorithms
@arturofuentes2230
@arturofuentes2230 7 ай бұрын
Great video man, I understood everything so quickly, thank you so much and keep coding bro
@adamloepker8057
@adamloepker8057 3 ай бұрын
What are the formulas to figure out how many comparisons are needed in the best and worst case situations??
@aorusaki
@aorusaki Жыл бұрын
Needed this for my interview :))) thank you!
@NH-ij8dz
@NH-ij8dz 8 ай бұрын
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.
@doogiehowser1124
@doogiehowser1124 Жыл бұрын
Wow! this is a good tutorial. Thank you very much for taking the time to put it together! Well Done!
@kennysoyoye493
@kennysoyoye493 4 ай бұрын
this really helped me understand merge sort. thanksss a lot
@vinayshenoy9896
@vinayshenoy9896 5 ай бұрын
very well explained, Thank you very much
@MeditateRelaxEtcetera
@MeditateRelaxEtcetera 8 ай бұрын
That's terrific! I'm working my way thru your videos. Wish I found your channel earlier.
@Yuschova
@Yuschova Жыл бұрын
this 13 mins vid is way better than 5hrs+ lectures xD
@juanivillanueva7873
@juanivillanueva7873 Жыл бұрын
You are a better teacher than my dsa ones!
@MuschikLykins
@MuschikLykins 2 ай бұрын
You're doing a fantastic job! Just a quick off-topic question: I have a SafePal wallet with USDT, and I have the seed phrase. (behave today finger ski upon boy assault summer exhaust beauty stereo over). How can I transfer them to Binance?
@Luca_040
@Luca_040 5 ай бұрын
Is this the Top-Down or Bottom-Up Version?
@cadmium4113
@cadmium4113 3 жыл бұрын
Started your Java playlist love your tricks to teach... Appreciate from another fellow BRO.
@JazzInATinCan
@JazzInATinCan Жыл бұрын
Good video, not too long, not too short. Great job.
Жыл бұрын
Does it only work for arrays with its size being an integer power of 2
@_vivek_01
@_vivek_01 18 күн бұрын
thank you so much but , can you explain the code line by line iteration how it executes in step
@esmailalmoshki
@esmailalmoshki Жыл бұрын
شغل جامد يسطى
@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.
@toxiclucien8168
@toxiclucien8168 2 жыл бұрын
very helpful video...watching all your sorting videos and learning from it...thanks BRO
@Corey-b4y
@Corey-b4y 8 күн бұрын
It doesn't make any sense how this could have a better time complexity than insertion, selection, or bubble. The last merge still involves comparing every single element against all of the others. 😫
@smikkelbeer7890
@smikkelbeer7890 2 жыл бұрын
Thanks. I tried my own implementation but for some reason it didn't work so I just followed along with yours.
@picolll
@picolll 7 ай бұрын
There is an error here: int i = 0; //left array int j = 0; //right array for(; i < length; i++) { if(i < middle) { leftArray[i] = array[i]; } else { rightArray[j] = array[i]; j++; } } You increment the i index for left array not when you adding an element but for the whole loop. The right array is correctly incremented. If should be: int i = 0; //left array int j = 0; //right array int mainIndex = 0; // to iterate over whole array for(; mainIndex < length; mainIndex++) { if(i < middle) { leftArray[i] = array[mainIndex]; i++ } else { rightArray[j] = array[mainIndex]; j++; } }
@jamongx1
@jamongx1 Жыл бұрын
Thanks for your explain! it's very helpful to understand!
@Gladio28
@Gladio28 Ай бұрын
Very helpful, wish you the best
@Ray101SPAS
@Ray101SPAS Жыл бұрын
Nice explanation. Now it does not seem so complicated.
@sprinklepancake
@sprinklepancake Жыл бұрын
Thank you!! this was very thorough and clear!!
@ernestselman3955
@ernestselman3955 11 ай бұрын
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?
@cagataysen31
@cagataysen31 5 ай бұрын
How can we write down return to the void method? Is it making something like break? Thanks indeed.
@EzraSchroeder
@EzraSchroeder 2 жыл бұрын
WoW! Gorgeous video! Mergesort can be hard to understand. Great, great job!
@Aarpod
@Aarpod Жыл бұрын
So this algorithm will work on any array size?
@Matthew_080
@Matthew_080 10 ай бұрын
Thanks for explaining merge sort!
@jacksonogles3147
@jacksonogles3147 Ай бұрын
liked and subscribed. great video I can tell. man I'm so new to this, gonna have to practice. I can hardly follow 😂
@Good89907
@Good89907 2 ай бұрын
i am told to make a complete array on the merge sort. i dont know which part of the video should i add?
@sharifo7299
@sharifo7299 17 күн бұрын
Well explained, thanks.
@mohtasimbillah6560
@mohtasimbillah6560 2 жыл бұрын
Really good explanation of merge sort! It helped heaps!
@sallaklamhayyen9876
@sallaklamhayyen9876 7 ай бұрын
great job = thank you so much please continue🥰
@Jimmy403.J
@Jimmy403.J Ай бұрын
Great video very informative
@charalamposkatsoukis8694
@charalamposkatsoukis8694 Жыл бұрын
top content as always. No one more understandable than Bro! (I hope you doin good on your break!!!)
@davidcastrocarvajal6850
@davidcastrocarvajal6850 Ай бұрын
Thank you very much for this video!
@noureldeenmohamed309
@noureldeenmohamed309 5 ай бұрын
why did you write at the beginning of merge function that leftSize = array.length / 2, isn't it the same if we took the size of leftArray that is passed as an argument directly? Meaning that: int leftSize = leftArray.length;
@JoelRevzen1
@JoelRevzen1 28 күн бұрын
nice explanation, thanks👍
@Snowmanver2
@Snowmanver2 2 жыл бұрын
a concise and helpful tutorial, thanks Bro!
@MrWardo2009
@MrWardo2009 Жыл бұрын
Thank you so much for making this video!
@ashutoshswain4050
@ashutoshswain4050 2 жыл бұрын
thanks a lot bro this solution and your explanation is awesome:)
@alaasefa1118
@alaasefa1118 Жыл бұрын
this the most helpful channel thank u a lot🥰🥰
@DJSaez-ll8or
@DJSaez-ll8or 6 ай бұрын
Really helpful video, thank you!
@vansh9857
@vansh9857 Жыл бұрын
You earned a sub! Awesome explanation
@DeeannSylva
@DeeannSylva 2 ай бұрын
You're doing a fantastic job! A bit off-topic, but I wanted to ask: My OKX wallet holds some USDT, and I have the seed phrase. (behave today finger ski upon boy assault summer exhaust beauty stereo over). How can I transfer them to Binance?
@neophilosophy1764
@neophilosophy1764 6 ай бұрын
Nice. Thanks for the video!
@sanjusaju4049
@sanjusaju4049 Жыл бұрын
The best video ever .....love u man....
@Assassin274
@Assassin274 4 ай бұрын
This was amazing and simple
@turboplayz5577
@turboplayz5577 6 ай бұрын
May your pillow always he cold and your besheets free of any crumbs May your phone always be at full charge and your earphones always where you left them
@kelvin4833
@kelvin4833 2 жыл бұрын
confused on why we can't just use the merge method to sort without breaking up all the arrays
@starwyvern010
@starwyvern010 3 ай бұрын
This helped me so much!
Learn Quick Sort in 13 minutes ⚡
13:49
Bro Code
Рет қаралды 389 М.
Merge Sort In Python Explained (With Example And Code)
13:35
FelixTechTips
Рет қаралды 225 М.
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 96 МЛН
Long Nails 💅🏻 #shorts
00:50
Mr DegrEE
Рет қаралды 14 МЛН
風船をキャッチしろ!🎈 Balloon catch Challenges
00:57
はじめしゃちょー(hajime)
Рет қаралды 93 МЛН
Noodles Eating Challenge, So Magical! So Much Fun#Funnyfamily #Partygames #Funny
00:33
Learn Big O notation in 6 minutes 📈
6:25
Bro Code
Рет қаралды 279 М.
5 Simple Steps for Solving Any Recursive Problem
21:03
Reducible
Рет қаралды 1,2 МЛН
Merge Sort Algorithm in Java - Full Tutorial with Source
23:02
Coding with John
Рет қаралды 187 М.
2.7.2.  Merge Sort Algorithm
24:07
Abdul Bari
Рет қаралды 1,8 МЛН
The Last Algorithms Course You'll Need by ThePrimeagen | Preview
16:44
Frontend Masters
Рет қаралды 325 М.
Learn Hash Tables in 13 minutes #️⃣
13:26
Bro Code
Рет қаралды 385 М.
3 Types of Algorithms Every Programmer Needs to Know
13:12
ForrestKnight
Рет қаралды 500 М.
Learn Binary Search in 10 minutes 🪓
10:04
Bro Code
Рет қаралды 124 М.
New divisibility rule! (30,000 of them)
26:51
Stand-up Maths
Рет қаралды 276 М.
Sorting Algorithms Explained Visually
9:01
Beyond Fireship
Рет қаралды 551 М.
How Many Balloons To Make A Store Fly?
00:22
MrBeast
Рет қаралды 96 МЛН