assignment1

# assignment1 - COT5405 Homework 1 Page 1 of 2 Problem 1 Give...

This preview shows pages 1–2. Sign up to view the full content.

COT5405 - Homework 1 Page 1 of 2 Problem 1 Give a problem P with size n , if it can not be solved in O ( f ( n )) time by any known algorithm, can we say the lower bound of P is Ω( f ( n ))? Why? Problem 2 Solve the following recurrence relations by giving Θ bound. T ( n ) = 3 T ( n/ 2) + n T ( n ) = 8 T ( n/ 2) + n 3 T ( n ) = 2 T ( n/ 4) + n ) T ( n ) = T ( n ) + 1 Problem 3 You are planning to buy gifts for your nephews at a gift store where there are n toys all with different prices. Suppose you have k nephews and d dollars in your pocket all of which you need to spend. The k -gift problem asks to find whether there are k toys with total cost exactly d . Design and analyze an o ( n 3 )(little oh) time algorithm for the 3-gift problem. Note that d should not come into your asymptotic time complexity. (Hint: solve the 2-gift problem first.) Problem 4 Suppose you were given a blackbox, which when given a list as input, returns a pivot in linear time in the following way: The list is partitioned into sublists of length 5. For each of these sublists, the median is found. Further, the median of these medians is found and returned

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the 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