Hello Friends, In this blog post I am going to let you know about a very important sorting technique in data structure that is Merge Sort.
Merging is the process of combining two or more sorted files into a third sorted file. Let ‘A’ be a sorted list containing ‘X’ number of elements and ‘B’ be a sorted list containing ‘Y’ number of elements.
Then the operation that combines the elements of A and B into new sorted list C with Z = X+Y number of elements is called merging. The merge sort works as follows:
Compare the smallest elements of A and B after finding the smallest, put into a new list C, this process is repeated until either list A or B is empty.
Now place the remaining elements of A (or perhaps B) in C. The new list C contains the sorted elements which are equal to the total sum of elements A and B lists.
For understanding the Merge Sort better please go through the below-given example of sorting the lists using Merge Sort step by step.
In the case of any queries, you can write to us at email@example.com we will get back to you ASAP.
Hope! you would have enjoyed this post about ‘Merge Sort In Data Structure’.
Please feel free to give your important feedbacks in the comment section below.
Have a great time! Sayonara!