Is the space complexity for these 2 mergesort implementations the same?
问题 Hello I would like you to tell me if the space complexity for those 2 mergesort algorithms is the same. Algo 1: def mergeSort(alist, l, r): if r - l >= 1: mid = l + (r - l)//2 mergeSort(alist, l, mid) mergeSort(alist, mid+1, r) i = l j = mid+1 k = 0 temp_list = [None]*(r-l+1) while i < mid+1 and j < r+1: if alist[i] <= alist[j]: temp_list[k] = alist[i] i=i+1 else: temp_list[k] = alist[j] j=j+1 k=k+1 while i < mid+1: temp_list[k] = alist[i] i=i+1 k=k+1 while j < r+1: temp_list[k] = alist[j] j