written_asgn3

# written_asgn3 - last two-thirds STOOGE-SORT(A,i,j-k first...

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

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);
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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern