
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

Make sure you show all you work and start early.
From “Data Structures, Algorithms, and Software Principles in C”
Also do this problem:
Professors Howard, Fine, and Howard have proposed the following sorting algorithm:
STOOGE-SORT(A,i,j)
if A[i] >A[j] swap (A[i], A[j]); if i+1 ≥ j return; k = ⎣(j-i+1)/3⎦; // round down STOOGE-SORT(A,i,j-k); // first two-thirds STOOGE-SORT(A,i+k,j); // last two-thirds STOOGE-SORT(A,i,j-k); // first two thirds again
a). Argue that STOOGE-SORT(A,1, length[A]) correctly sorts the input array A[1..n], where n=length[A].
b). Give a recurrence for the worst-case running time of STOOGE-SORT. Solve the recurrence relation and find the running time using Big-O notation.
c). Compare the worst case running time of STOOGE-SORT with that of insertion sort, merge sort, bubble sort, and quicksort. Doe the professors deserve tenure?