In an Incedo QA automation pipeline, test results arrive as an unsorted array of integer execution times. Implement a function that returns the values in nondecreasing order without using Python's built-in sort() or sorted() functions.
Use an algorithm with O(n log n) worst-case time complexity. The input array may contain duplicate values, zero, and negative integers. The function may allocate additional memory, but it must not call any library or built-in sorting routine.
nums, a list of integers.nums, arranged in nondecreasing order.sort(), sorted(), heaps, or external sorting libraries.def sort_array(nums):