Your question is Sorting Algorithm Implementation. 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.
A MATLAB data-processing utility needs a predictable, stable ordering for numeric signal samples before further analysis. Implement stable_merge_sort in Python to return the values in nondecreasing order without calling sorted, .sort(), or another library sorting routine.
The algorithm must be stable: if two values compare equal, their relative order must be preserved. Since the input contains primitive numeric values, stability is observed through consistent left-before-right merging when equal values are encountered.
nums, a Python list of integers or floating-point values.nums, sorted in nondecreasing order.nums is empty.def stable_merge_sort(nums):