https://github.com/pcputta/Algorithms-Lab/tree/master/Quicksort
check this solution of mine though it is for Quick sort it can be easily incorporated into mergesort