Midterm_solution _2_ - Midterm Exam-Solution Introduction...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Midterm Exam-Solution Introduction to Algorithms, spring 2009 1. [10 points]Use a recursion tree to determine an asymptotically tight bound to the recurrence T(n) = T(n/3) + T(2n/3) + O(n). Use the substitution method to verify your answer. 2. [15 points] Solve the following recurrences by giving tight Θ -notation bounds. You need to justify your answers. (a) T (n)=3T (n/5)+lg 2 n (b) T (n)=2T (n/3)+n lg n (c) T (n)=T (n/5)+lg 2 n (d) T (n)=8T (n/2)+n 3 (e) T (n)=7T (n/2)+n 3
Background image of page 1

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

View Full DocumentRight Arrow Icon
3. [10 points] A. Give the recurrences that describe both worst-case and randomized quicksort running time (you don’t need to obtain the running time). B. A smart NTHU professor claims that he has discovered an O (n) time sorting algorithm (in the comparison model). Prove that he is wrong. Solution: A. Worst-case : T(n)=T(n-1)+ Θ (n) Randomized: T(n)= B. The number of leaves of a decision tree which sorts n numbers is n!, and the height of the tree is at least lg(n!), where nlgn lg(n!). 4. [10 points] Professor Cecilia uses the following algorithm for merging k sorted lists, each having n/k elements. She takes the first list and merges it with the second list using a linear-time algorithm for merging two sorted lists, such as the merging
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/26/2009 for the course CIS 502 taught by Professor Naver during the Spring '09 term at National Tsing Hua University, China.

Page1 / 6

Midterm_solution _2_ - Midterm Exam-Solution Introduction...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online