An efficient and stable divide-and-conquer sorting algorithm. [Best: O(n), Average: O(nlgn), Worst: O(nlgn), Space: O(n)]
Idea
The idea of merge sort uses a classic divide-and-conquer approach. By recursively dividing the array into smaller sub-arrays, the sub-arrays will finally all become sorted (at most 1 item). Next, those sub-arrays are merged back together in a sorted manner until all becomes one. It is an efficient and stable sorting algorithm.
Implementation
Below is an implementation of merge sort in golang.