Merge Sort is a Divide and Conquer algorithm. It divides the input array into two halves, calls itself for the two halves, and then merges the two sorted halves.
- Find the middle point to divide the array into two halves.
- Call mergeSort for first half.
- Call mergeSort for second half.
- Merge the two halves sorted in step 2 and 3.
Given array is 12 11 13 5 6 7
Sorted array is 5 6 7 11 12 13