hw4solns - 1 CMPS 101 Summer 2009 Homework Assignment 4...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 CMPS 101 Summer 2009 Homework Assignment 4 Solutions 1. (3 Points) Consider the function ) ( n T defined by the recurrence formula ≥ + < ≤ = 3 ) 3 / ( 2 3 1 6 ) ( n n n T n n T a. (1 Points) Use the iteration method to write a summation formula for ) ( n T . Solution: ) 3 / ( 2 ) ( n T n n T + = ) ) 3 / 3 / ( 2 3 / ( 2 n T n n + + = ) 3 / ( 2 3 / 2 2 2 n T n n + + = ) 3 / ( 2 3 / 2 3 / 2 3 3 2 2 n T n n n + + + = etc.. After substituting the recurrence into itself k times, we get ) 3 / ( 2 3 2 ) ( 1 k k k i i i n T n n T + = ∑- = . This process terminates when the recursion depth k is chosen so that 3 3 / 1 < ≤ k n , which is equivalent to 3 3 / 1 < ≤ k n , whence 1 3 3 + < ≤ k k n , so 1 ) ( log 3 + < ≤ k n k , and hence ) ( log 3 n k = . With this value of k we have 6 ) 2 or 1 ( ) 3 / ( = = T n T k . Therefore ) ( log 1 ) ( log 3 3 2 6 3 2 ) ( n n i i i n n T ⋅ + = ∑- = . b. (1 Points) Use the summation in (a) to show that ) ( ) ( n O n T = Solution: Using the above summation, we have ) ( log 1 ) ( log 3 3 2 6 ) 3 / 2 ( ) ( n n i i n n T ⋅ + ≤ ∑- = since x x ≤ for any x ) 2 ( log 3 6 ) 3 / 2 ( n n i i + ≤ ∑ ∞ = adding ∞-many positive terms ) 2 ( log 3 6 ) 3 / 2 ( 1 1 n n + - = by a well known formula ) ( 6 3 ) 2 ( log 3 n O n n = + = ) ( 1 ) 2 ( log 3 2 ) 2 ( log 3 3 n o n = ⇒ < ⇒ < Therefore ) ( ) ( n O n T = . 2 c. (1 Points) Use the Master Theorem to show that ) ( ) ( n n T Θ = Solution: Let ) 2 ( log 1 3 >- = ε . Then 1 ) 2 ( log 3 = + ε , and ) ( ) 2 ( log ) 2 ( log 3 3 ε ε + + Ω = = n n n . Also for any c in the range 1 3 / 2 < ≤ c , and any positive n , we have cn n n ≤ = ) 3 / 2 ( ) 3 / ( 2 , so the regularity...
View Full Document

This note was uploaded on 12/03/2009 for the course CS CS101 taught by Professor Agoreback during the Spring '09 term at American College of Gastroenterology.

Page1 / 4

hw4solns - 1 CMPS 101 Summer 2009 Homework Assignment 4...

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