Recurrences
Recurrences
COMP4500/7500 July 30, 2019
July 30, 2019 1/49
Recurrences
Divide and conquer algorithms
MERGE_SORT(A,p,r) sorts subarray A[p..r]. MERGE(A,p,q,r) takes sorted subarrays A[p,q] and A[q+1,r]
and merges them to produce sorted array A[p, r ]. Assumes MERGE(A,p,q,r) is ⇥(n) where n = r p + 1.
MERGE_SORT(A,p,r)
1 2 3 4 5
ifp