Merge sort explained with simple example
Merge sort is one of the simplest sorting algorithm, which works on Divide and Conquer algorithm. In this sorting algorithm, input data is divided into two halves/sublist which then acts as input data and furthur divided into two halves so that finally every sublist contains a single element. Finally, these sublists are merged in sorted order which results into sorted data.
Pros:
1) Simple algorithm and hence efficient for small list of data.
2) Good for sorting data represented in Linked list.
3) This algorithm is stable (performance is equal in all cases) and insensitive to the distribution of initial data.
Cons:
1) Extra space needed in O(n).