MergeSort for both array and linkedList.