Learning Algorithms Recipes: Mergesort
This is an algorithm to sort an array. It can be classified as a divide and conquer algorithm. Input: array of elements. E.g. arr = [5, 4, 1, 2] Output: sorted array Time Complexity: 0(nlogn) def merge_sort(L): if len(L) > 1: mid = len(L) ...
Mar 27, 20211 min read33