Merge Sort
Table of Contents
- Merge Sort - Pros - Cons
Merge Sort
Merge sort follows the divide and conquer paradigm.
For mergesort
- We break the array into two subarrays to be sorted and then combine the ordered subarrays to make the whole ordered array;
- We do the two recursive calls before working on the whole array;
- The array is divided in half;
Pros
- Mergesort guarantees to sort an array of N items in time proportional to N log N, no matter what the input.
Cons
- Its prime disadvantage is that it uses extra space proportional to N.