Use merge sort on a list of integers:
sml
fun sort xs = mergeSort (op <=) xs;
Here mergeSort denotes the standard merge sort implementation: split into two almost equal lists, recursively sort them, and combine them using the merge algorithm. Splitting and merging take linear time, and each recursion level has total input length . There are levels, so the worst-case time complexity is . Equivalently, .

Articles by others on the same topic (0)

There are currently no matching articles.