How would you implement a sorting algorithm?
Implement merge_sort(nums) using a comparison-based algorithm and return the values in nondecreasing order without modifying nums. For example, [5, 2, 4, 1] returns [1, 2, 4, 5], and [3, 3, -1] returns [-1, 3, 3]. The input may be empty and contains at most 1,000 integers.
def merge_sort(nums):