Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then merges the two sorted halves. The merge() function is used for merging two halves. The merge(arr, l, m, r) is key process that assumes that arr[l..m] and arr[m+1..r] are sorted and merges the two sorted sub-arrays into one.
Given array is 12 11 13 5 6 7 Sorted array is 5 6 7 11 12 13
Please refer complete article on Merge Sort for more details!
- Python Program for Iterative Merge Sort
- Python Program to Count Inversions in an array | Set 1 (Using Merge Sort)
- C Program for Merge Sort
- Java Program for Merge Sort
- C Program for Iterative Merge Sort
- Java Program for Iterative Merge Sort
- Merge Sort with O(1) extra space merge and O(n lg n) time
- Why Quick Sort preferred for Arrays and Merge Sort for Linked Lists?
- Python Program for Odd-Even Sort / Brick Sort
- Quick Sort vs Merge Sort
- Merge Sort vs. Insertion Sort
- Iterative Merge Sort
- In-Place Merge Sort
- Merge Sort using Multi-threading
- Visualization of Merge sort using Matplotlib
- Merge Sort for Linked Lists
- Iterative Merge Sort for Linked List
- Sorting Algorithm Visualization : Merge Sort
- Concurrent Merge Sort in Shared Memory
- Merge Sort for Doubly Linked List
Improved By : Dravid