How would you implement a specific sorting algorithm?
Implement merge sort for an array of integers without using sort() or sorted(). Return a new array containing the same values in nondecreasing order. The input may be empty, and the implementation should preserve the relative order of equal values.
def merge_sort(nums):