Question: NewSort ( A , p , r ) n = r - p + 1 if ( n < = 1 0 ) then InsertionSort
NewSortA p r
n r p
if n
then
InsertionSortA p r
else
k n
NewSortA p r k
NewSortA p k r
NewSortA p r k
a Explain why, after calling NewSortA n the array A would be sorted from to n Your explanation does not need to be formal, just enough to convince the professor.
b Write the recurrence that describes the algorithm's runtime and solve it The floor and ceiling functions should be very precise.
c Comment on the following statement: if the InsertionSort from line were replaced by MergeSort, the asymptotic behavior of the function would improve.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
