CSC 1351 Chapter : 1351 Practice 3 Recursion
Document Summary
Shown below in (a)-(b) are the rst two of the three steps in the pseudocode for merge-portion of the merge- It assumes that mergesort(left, mid) and mergesort(mid+1, right) have been completed in ordering the subarraya nums[leftmid] and nums[mid+1right] in increasing order. (a) [show this part of the pseudocode; be brief but very clear. ] Give an example of nums[] after the calls mergesort(0, 3) and mergesort(4, 6) have completed such that step (c) makes no change in nums-array. (assume nums[] was initially a permutation of {0, 1, , 6}. ) Give an example of nums[] after the calls mergesort(0, 3) and mergesort(4, 6) have completed such that step (c) changes every item in nums-array. (assume nums[] was initially a permutation of {0, 1, , 6}. ) Consider a call-return diagram for some recursive function f( ), which makes at most two recursive calls, as shown below. (we do not know at this point any things else about f( ). )