written_asgn3 - // last two-thirds STOOGE-SORT(A,i,j-k); //...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Written Assignment III COP3502H Due: Wednesday, 4/11/07 in class Make sure you show all you work and start early. From “Data Structures, Algorithms, and Software Principles in C” 1. page 547, #1,2 2. page 551, #1 3. page 571, #1 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);
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: // 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?...
View Full Document

This document was uploaded on 06/12/2011.

Ask a homework question - tutors are online