sorts.recursive_mergesort_array

A merge sort which accepts an array as input and recursively splits an array in half and sorts and combines them.

Functions

merge(→ list[int])

Return a sorted array.

Module Contents

sorts.recursive_mergesort_array.merge(arr: list[int]) list[int]

Return a sorted array. >>> merge([10,9,8,7,6,5,4,3,2,1]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> merge([1,2,3,4,5,6,7,8,9,10]) [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] >>> merge([10,22,1,2,3,9,15,23]) [1, 2, 3, 9, 10, 15, 22, 23] >>> merge([100]) [100] >>> merge([]) []