Question: Answer the following questions about the RecMystery Sort algorithm below. Input: A: array with n real numbers Input: n: size of data Output: permutation of
Answer the following questions about the RecMystery Sort algorithm below. Input: A: array with n real numbers Input: n: size of data Output: permutation of data such that A[1] S A[2] S... A[n] 1 Algorithm: RecMystery Sort 2 if n = 2 then 3 if A[1] > A[2] then 4 Swap A[1] and A[21: end 6 else ifn > 1 then 7 first In/4); 8 third = n-first; 9 RecMysterySort(A[1..third]); 10 RecMystery Sort(A[first..n): 11 RecMystery Sort(A[1..third]); 12 end 13 return A a) [10 points) Write a recurrence that describes the worst case time complexity of RecMysterySort. Show your work. b) [5 points) Find the worst case time complexity of RecMysterySort. Show your work. c) [10 points) How does RecMysterySort compare to MergeSort and InsertionSort? Justify your answer. A table of approximate log values appears below. 108.(3) log: (1) log(1) log, (4) log2 (1) log2 (:) log; (3) log: (4) log; (3) log: (4) 0.792 0.208 -0.208 1.262 0.262 -0.262 3.819 4.819 -3.819 -4.819
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
