ass02 - 4. Consider a rectangular array of distinct...

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

View Full Document Right Arrow Icon
Fall 2011 CS 513: #2 Farach-Colton Due by the beginning of class, Sep. 20. 1. Find a closed form for the recurrence: T (1) = 1 T ( n ) = 2 T ( n/ 2) + log n (for n 2) You may assume n is a power of 2. Give a tight “big-oh” bound on T . Show your derivation and prove your answer is correct. 2. Find a closed form for the recurrence: T (2) = 1 T ( n ) = nT ( n ) + n (for n 2) You may assume n is of the form 2 2 k . Give a tight “big-oh” bound on T . Show your derivation and prove your answer is correct. 3. The merge algorithm presented in class was not in place . Assume you are given an array A [1] ,...,A [ n ] where A [1] ,...,A [ k ] is one sorted list and A [ k +1] ,...,A [ n ] is another sorted list. Write an in place algorithm that merges A [1] ,...,A [ k ] and A [ k + 1] ,...,A [ n ]. Explain how your algorithm works and derive its worst case running time. Show an example where the running time is worst case.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 4. Consider a rectangular array of distinct elements. Each row is given in increasing sorted order. Now sort (in place) the elements in each column into increasing order. Prove that the elements in each row remain sorted. 5. Show that if you have a subroutine for HamP which runs in polynomial time, you can solve the HamC problem in polynomial time. 6. Show that if you have a subroutine for HamP which runs in polynomial time, you can actually find a hamiltonian path in polynomial time. Extra Credit: Consider the following recurrence: T (1) = 1 T ( n ) = T ( n/ 5) + T (7 n/ 10) + n. You need not give an exact closed form for this recurrence, but give a tight “big-oh” bound on T . As always, prove your answer is correct....
View Full Document

This document was uploaded on 12/18/2011.

Ask a homework question - tutors are online