Merge Sort Algorithm | How Merge Sort Works (Example Diagram) | Part - 1 | Sorting Algorithms - DSA
Understand or Merge Sort sorting algorithm works with easy example & visual diagram. We will dry run the merge sort algorithm step by step by taking a diagram example to understand the flow of the algorithm at every step.
Theory -
1. Merge Sort is a Divide and Conquer algorithm.
2. It divides input array in two halves, calls itself for the two halves(recursively) and then merges the two sorted halves.
3. A separate merge() function is used for merging two halves.
4. Merge sort is one of the most efficient sorting algorithms.
5. Time Complexity: O(nlog(n))
---------------------------------------------------------------------------------------------
Full DSA playlist - • Introduction to Data S...
Full Code & Theory article - simplesnippets.tech/merge-sor...
C++ Programming Tutorials for Beginners Course - • Introduction to Comput...
---------------------------------------------------------------------------------------------
Support Simple Snippets by Donations -
Google Pay UPI ID - tanmaysakpal11@okicici
PayPal - paypal.me/tanmaysakpal11
---------------------------------------------------------------------------------------------
Simple Snippets Official Website -
simplesnippets.tech/
Simple Snippets on Facebook -
/ simplesnippets
Simple Snippets on Instagram -
/ simplesnippets
Simple Snippets on Twitter -
/ simplesnippet
Simple Snippets Google Plus Page -
plus.google.com/+SimpleSnippets
Simple Snippets email ID -
simplesnippetsinfo@gmail.com
For More Technology News, Latest Updates and Blog articles visit our Official Website - simplesnippets.tech/
#mergesort #sortingalogrithms #dsa #divideandconcquer #algorithms
Пікірлер: 478
Best explaination of the recursion part..... haven't seen this much detailed explanation for recursion in any other KZread video
@SimpleSnippets
4 жыл бұрын
Thank you so much buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@sakshamdwivedi2527
2 жыл бұрын
You are true bro ...
@BrettPenza
2 жыл бұрын
Yes, agreed. So many simple overviews out there that don’t give the true flow of the recursion, which results in a total misunderstanding of how recursion works in general. But this explanation is Outstanding!!! Thanks very much.
@AnkammaRaoJ
Жыл бұрын
100% TRUE NO BODY EXPLAINED ABOUT RECURSION EXPECT YOU
Such a premium content. Even expensive courses are not upto this level. Keep up the good work man!
U have talent in such a way that even a beginner can understand the concept so clearly.Thank you so much.God Bless💯☺️
@SimpleSnippets
3 жыл бұрын
Thanks a lot 😊 It would mean a lot if you could please share our channel and videos with your friends too ✌
@gorrepatimadhu6025
3 жыл бұрын
@@SimpleSnippets Sure Bro!! I have a small request please make more videos on file handling and exception handling in c++
Spent 4 days, understanding this algorithm, most other video gives theoritcal concept without the in-depth analysis, your video is best because the way you explained the pause part that's where I could not go forward initially. You are meditative.
@SimpleSnippets
3 жыл бұрын
Glad it helped! Thanks for such a wonderful feedback Dinesh. Means a lot. Please support me by sharing the videos with your friends too!
I don't know why this video is underrated. This video is very deep and clear. He showed what is happening behind the scenes which many teachers on youtube did not explained in their videos and had so much views. Great Job man. I was looking for this kind of explanation.
@SimpleSnippets
2 жыл бұрын
Thanks Shivam. Really glad to see such genuine appreciation and feedback♥️😊
@rayyanamir8560
2 жыл бұрын
yes. you are right
I watched this one year ago and came here back today and I must say you are great sir! Thank you, your channel definitely deserves more subscribers, views and likes, always count on my support❤️
I just finished my Data Structures course and wanted to explore algorithms in my free time, beautiful explanation. You explain these concepts like a university professor!
@rayyanamir8560
2 жыл бұрын
*better than university professor
@SimpleSnippets
9 ай бұрын
Great to hear!
Uff!! finally watched 52min video in 2hour in single sitting 😅 thank you so much for clearing my whole confusion on recursion and merge sort ❤️❤️ god bless you brother!
I literally watched all other youtubers videos..i guess i watched atleast 7 to 8 videos but didnt understood perfectly..but by your 1 video the concept is totally clear to me. ..thanks for this amazing video😍
I have to do a presentation in class about this algorithm and I stubled unpon your video trying to understand it better. I have to say, this is one of the best explanations I have ever heard about anything. Great job man, going through all the steps the program go through was REALLY helpful. Have a great day.
After watching 2-3 tutorials on same topic it wasn't cleared but now it's cleared thanks for such a great explanation.
Tanmay: "Make sure to keep your phones aside." Me watching this on phone: 'Error 401'.
@SimpleSnippets
4 жыл бұрын
Lol 😂
Even a noob can understand merge sort from this video. Keep doing the good work brother 🙏
No words to say , i think some people have kind of special gift, if they explain everyone will understand . You are one of them
@SimpleSnippets
4 жыл бұрын
Thank you so much Puneeth bro this means a lot 🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Buddy, you made it very easy to understand. Never seen such a simplified dry run for merge sort! Keep going!
I've searched all merge sort videos on youtube, but could not find a better one. Best recursion explanation ever.
Now, I have a clear understanding of mergesort. I watch a lot of merge sort videos, but this clears all my doubts.
@SimpleSnippets
4 жыл бұрын
I'm glad to hear this from you Manas, please share and support my channel ✌️
The effort that you give to explain each and every line is of GOD LEVEL. THANKS A LOT
@SimpleSnippets
2 жыл бұрын
Thanks Gargi 🙏🤩
The person who disliked this is a commerce student who came here by mistake !
@SimpleSnippets
4 жыл бұрын
😂😂😂😂😂😂 good one! 😂😂😂😂
@mdminhaj8567
3 жыл бұрын
Six commerce students got in this video who's dislike it 😂 By the way - One of the best video about merge sort algorithm.
@SimpleSnippets
3 жыл бұрын
Hahaha 🤣
@SimpleSnippets
3 жыл бұрын
😂😂😂 chill savage people chill 😂😂❤️❤️
@GoogleUser-nx3wp
3 жыл бұрын
nice roast 😂😂😂
Tanmay sir , its an overwhelming moment for me , as i was trying to understand this from a long time and this was the video which made me understand the dry run of the code, tysm sir..
My tutor, thank you so much for helping me to fully understand this algorithm. I bought a course online, I don't want to name the site but the tutor could not explain like you did. Trust me your channel is worth sharing and I will share it on my Social media with friends. God bless you!
@SimpleSnippets
4 жыл бұрын
Thank you so much Albert. I'm very happy to hear this from you buddy. 😊 My tutorials are free for everyone. Please share them with everyone you know. That's the biggest support ✌️
@albertd.bangura3794
4 жыл бұрын
@@SimpleSnippets the pleasure is truly mine!
A grand salute to u brother for an efficient explanation.........Time Complexity Of Understanding- (n log n) same as merge sort.
One of the best recursion explanations on this platform. And Merge Sort algorithm explanation was 🔥🔥🔥
@SimpleSnippets
3 жыл бұрын
Glad you think so! Thanks bro, please do share the videos & our channel with your friends too. Thats the biggest help and support you can give back to this channel! 😇
Literally the best video on the internet for merge sort. Amazing!!!!
Thanks a lot Sir. Because of merge sort I hated recursion a lot. Despite knowing how recursion works, I failed to figure that out for merge sort. But today you made me love the concept of recursion.
This explanation is insane. This is what i was looking for few days. Best dry run ever. I saw so many video they just divided the array and said thats what we have to do but didn't explained the flow . Hatss of brother.
@SimpleSnippets
9 ай бұрын
I am glad you liked it! Please do share the video with your friends too!
Hi bro, Your Tutorial and the way of explaining everything is amazing. I really liked you Dry Run explanation it was so easy and transparent to go with the algorithm step by step. Keep it up and Hope, more interesting and exciting videos with better explanation will come soon, I am eagerly waiting for your videos. Thank you😊
@SimpleSnippets
4 жыл бұрын
Thank you so much bro😊 this was such a great feedback. And yes when it comes to data structures and algorithms, the best way to understand is to dry run each step & maybe even do it visually with diagrams. That's how we understand exactly what's going on behind the scenes. Also yes more videos coming soon ✌️ please do share the videos with your friends too ✌️😊
@Summer-me4pt
4 жыл бұрын
Well said
Sir,, Dil ❤️ se like kiya.... thank you..... for this wonderful explaination..... I know , clicking on the ads is how much required , so I always click on the ads that come in your videos....
@SimpleSnippets
4 жыл бұрын
Thats really great to know buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@30secondsEmotions
4 жыл бұрын
@@SimpleSnippets I will surely support and promote your channel.... don't worry.... I will be glad by supporting you.... don't worry...I will refer your channel in every social network sites.....
No Wonder software developers an engineers are paid a lot of money, you guys are wicked smart. Best explanation ever
@SimpleSnippets
3 жыл бұрын
Thank you so much buddy. It would mean a lot if you could please share our channel and videos with your friends too ✌
Best explanation among the available merge sort explanations on KZread
One like isn't enough for this. Superb explanations.
@SimpleSnippets
3 жыл бұрын
Thank you so much 😀
I had to take 2 naps to complete this video, but glad I understood everything soooo well, Thank you soooo muchh!
@SimpleSnippets
3 жыл бұрын
Damn thats a lot of napping in between but its great that you understood it regardless of the breaks 😇
Very Explained and in-depth solution of Merge Sort Algorithm ! Thank You Very Much !
Man .. this Dry code helps a lot. and clear everything. Love u man. I was searching for this kind of video and you have the best one indeed. please keep it up you are helping so many students
Thank You So Much Sir for such a wonderful explanation. I was very confused while doing the dry run of the merge sort. Now, after watching your video, I have no doubt regarding merge sort. You have made a premium content.
Thank you very much for explaining this way! I appreciate you walking through the algorithm it very helped me to understand it at a fundamental level. Not enough quality content like this that i've found. I'm going to try it by hand myself now :)
Woww I have no words.... this is a master class, Thank you.
Dude I was suffering just cause of this merge function..... for the past 3 days Or so...... You're a life saver bro...
Best recursion Explaination and this is how a beginner can understand very clearly.
this is by far the best explanation, i was confused with the recursion and this video helped me
So much detailed explanation of the recursive functions! Badly wanted them: Thanks!
This is the best video I've seen about this algorithm! Thanks for posting.
I had a hard time understanding this concept for quite a while. But this video alone cleared them all and I think this 53 minte session was totally worth it .thanks for such awesome explanation and the hard work. Peace ☮️
Wtf 53 mins have already passed... Whoa!!! This is the best explanation of MERGE SORT out there. Thanks a ton, buddy :)
Thank you so much!!! This is exactly what I was looking for. I had seen many implementations of Merge Sort, but I had not understood how it was actually manipulating the array, and now I have a clear idea of what is actually happening. I wish you the best!
@SimpleSnippets
8 ай бұрын
Glad it was helpful!
PERFECTION ,that's what this channel is ....... The way you teach is second to none 💯🔥💯🔥 KEEP IT UP !!
@SimpleSnippets
2 жыл бұрын
Dayum son 🔥❤️ thanks bro 😊 this is too big compliment for me 🙏 Means a lot 😊✌️
Great explanation.... I haven't seen this much deep explanation of recursion on youtube or on any other platform... Well done
best explanation of merge sort.....now i have got clear understanding of merge sort thanks for this help
This video is the best I’ve seen finally !!! You are a blessing thanks
This algo is really useful for understanding recursion 2 minute silence for the peeps who think "ye kya kaam ane wala ha"
@SimpleSnippets
4 жыл бұрын
Hahah agreed! Thank you so much for this positive feedback! And yes recursion is used in many many applications!
Jazakallah.. I couldn't find a better explaination anywhere
For the last two days, I was stuck in the merge sort. I watched many videos but the merge algorithm was not clear to me. Finally, I found your video and the dry run of each level helped to understand the complete merge sort algo clearly. Thank you so much for your effort. We are much obliged to you, bro.
@SimpleSnippets
9 ай бұрын
Thank you so much for such wonderful feedback :-)
I assure you I have watched lots of videos to understand the flow of execution :D and this is simply the best one, thank you bro !
your lecture is 10times better than paid course, if u post videos on CP i think your channel will get next level boom!!!
@SimpleSnippets
3 жыл бұрын
Thanks a ton, and yes I am thinking about CP!
@rudyf.4055
Жыл бұрын
what is CP?
@mukulrawat8584
Жыл бұрын
@@rudyf.4055 connaught place
Bro thank you so much whenever i get stuck in any coding problem you are my go to channel thank you so much god bless
great video, you really explained this well. The walk through and step by step repetitiveness of your explaining really made this as easy as it could be to understand.
If possible please make video on Backtracking or String combination. Thanks in advance. Love you Bro. I never ever seen in my life this kind of explanation on youtube. Only one line for you and you hardwork *Hats off to you* 👏 💐
Your explaination of the recursive part and also the marging part is damn great 👍🏻, thank bro, you have cleared my recursion problems. I didn't see this type of explaination in any video ever.
I am taking Algorithms class rn, your video about selection sort was a big help, and so are all of these. I love you man, keep up the great work!
@SimpleSnippets
2 жыл бұрын
Thank you so much Shahid 😊 very happy to hear that my videos helped you. And keep doing the great work of sharing knowledge 🤘✌️
It's really helpful for the people who want to know about the merge sort.. thank you
amazing and really well explained. even after explaining, I know how much struggle it takes to edit n all to create a masterpiece like this
@SimpleSnippets
3 жыл бұрын
Glad it was helpful! And yes it takes a lot of time to make these videos!
I would like to congratulate you, because your explanation about this algorithm was amazing! I finally understand how merge sort algorithm works just because i watched to your video. So, thank you very much!
@SimpleSnippets
4 жыл бұрын
Thank you so much Matheus, this means a lot to me. Please support me by sharing this channel with your friends too. Thats the biggest help and support ✌
Absolutely wonderful explanation of MergeSort! I was amazed at how in-depth you went in your video and I know recording this took a *lot* of time! Bravo, well done! I'm using this for my Java class, but if all of your videos are this in-depth, I may start learning C++ just to support your work. It is rare to see a teacher willing to put so much effort into their craft.
@SimpleSnippets
9 ай бұрын
Thank you so much for your wonderfull feedback. Yes this video took a lot of time and effort to make but it seems like it turned out very well! And your positive comments and feedback really make me feel it was all worth it! :)
thank you so much for a detailed dry run of the code
Have watched many videos for understanding the Merge and recursion concept and finally found the right one 👍🏻
@SimpleSnippets
3 жыл бұрын
Great to hear this Dinesh! Check out the DSA playlist for more. I think you will like it!
You helped me to gain my confidence in DSA bro....Love you a lot
Wow litrally wow What a explanation!!! This is the best explanation .Thank You very much Sirg
thank you so much man... the recursion part was really frustrating (before watching your video) as nowhere I could find a proper explanation of how it worked!! really helpful!
Thank you very much. A step by step explanation on what the computer does in this code which is very helpful to me and to many people. I cant thank you enough. Hope you make more videos
Hello Tanmay Sakpal ..... I become a fan of your teaching method and your voice and this is the first time I am appreciating a learning video. such a great work. I love your lessons and I also giving advice to my classmates that they should also learn from here. I am really really passionate from you and hoping for your success in your related field. May you achieve all happiness of life and I hope that your parents also feel proud of you
@SimpleSnippets
4 жыл бұрын
Thank you so much buddy for such a wonderful feedback. Really means a lot to me and I am happy that you are learninf from these videos. Keep sharing the videos and our channel with your friends too. Thats the biggest help ✌😇
best video on merge sort ever the explain is too good.
Best explanation, after searching for many videos , I finally understood the concept behind merge sort algorithm, step by step❤️🙏
@SimpleSnippets
3 жыл бұрын
Glad to hear that
You give the best and smallest array that explain every piece of code Thanks a lot 🙏
great explaination as i anot from IT background and new to this ALGOrithm..thanks a lot and keep up the good work
My youtube feed consists only of 2 tanmay - Tanmay Sakpal and Tanmay Bhatt. Both are legends.
@SimpleSnippets
3 жыл бұрын
Aare bhai bhai 🙏❤️ thank you so much 😊
man you saved my life, thank you so much.
You‘re doing gods work right there! I‘m getting closer to my Algorithms and Datastructures exam and I was struggling so hard with the recursion. I do understand the MS-algorithm now. After this video I will watch your vid regarding the quick sort algorithm. Thank you from Germany.
@SimpleSnippets
9 ай бұрын
Happy to know my video helped you! Keep growing!
really appreciate your way of teaching, hats off
This is very nice. I have spent days trying to unravel this mergesort. You have really explained it very well. Thanks bro
you are just unbelievably good keep up and thank you
Best explanation on the recursion part Thankyou very much How merge sort work is very difficult to understand but you are ❤️❤️❤️❤️
this is the best explanation ive ever come across thanks a mill to u 👏👏👏
@SimpleSnippets
3 ай бұрын
Thank you 🙏
good efforts !! , thanku ,smjh aa gya !
Love you man, this video helped me in understanding merge with recusion. 💯% satisfied and 💯% recommended
Much appreciated.... Hat's off to your patience level....👏👏👏👏 Thank you so much for this detailed explanation
Great effort man, great explanation. Loved the whole video. It's superr smooth. Loved it
@SimpleSnippets
3 жыл бұрын
Glad you liked it😇
So much effort in explaining the method, very appreciated man learned a lot from you
Bro you made my day I was struggling with merge sort and you have clear all my doubts 🙏
@SimpleSnippets
4 жыл бұрын
Thats great to know Aashish bro🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@aashishshah1187
4 жыл бұрын
@@SimpleSnippets definitely bro your method and ideas are damn good.
@aashishshah1187
4 жыл бұрын
Bro do you have a video on graph data structure.
insane bro...practically insane.Keep up the good work and thanks a lott
@SimpleSnippets
3 жыл бұрын
Thanks, will do!
Your explanations are fantabulous, especially this! Sometimes I may not end up understanding clearly in the very first watch but able to attain whole clarity in the very next watch at least. Thank you, thank you so so much! 😊🤩
@SimpleSnippets
3 жыл бұрын
Happy to help! It would mean a lot if you could please share our channel and videos with your friends too ✌
Extremely good explanation with visual demonstration of values at each level is indeed useful. You have also cleared doubt of recursion :)
love it man ,i got the idea of solving within first 15min of ur video .Great man great work.
@SimpleSnippets
4 жыл бұрын
Thats amazing bro! Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
Thank you so much sir for this helpful video. now I could clear my concept of merge sort which was very confused for me. Thanks a lot again.
the best explanation ever.
Thank You Very much . Finally understood this concept . May God bless U.
This video was amazing !!!.. Easy explanation, Thank You
such a premium content, you just deeply explained the concept. thankyou sir.
@SimpleSnippets
2 жыл бұрын
Most welcome Himanshu. I'm glad you liked the quality of the content 😊❤️
Great Video Sir !! Excellent Explanation
Best explanation!!! Thank you so much Tanmay
This was amazing!!! Thank you so much, bhaiya, great efforts🙏💝