Your question is Sort Without Native Functions. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Wpromote's Polaris analytics workflows may need deterministic ordering for metric values before generating reports. Given an array of integers, return the values in nondecreasing order without calling Python's sort() or sorted() functions.
Implement sort_numbers(nums), where nums is a list of integers. Return a new list containing the same values in nondecreasing order. The input may contain duplicates, negative values, or zero. Do not rely on any native sorting function.
A merge sort implementation is expected. It should divide the input into smaller subarrays, recursively sort them, and merge the sorted results. The implementation must preserve duplicate values and handle an empty input.
def sort_numbers(nums):