optimization of merge sort