{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

t2ans - CS3230 Tutorial 2 1 Which of the following...

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

CS3230 Tutorial 2 1. Which of the following recurrence relations can be solved using the master theorem? If it cannot be solved, state so. If it can be solved, give the answer (in terms of Θ notation) and state which clause of the master theorem applies. (a) T ( n ) = 15 T ( n/ 3) + n 3 . Ans: Yes. a = 15, b = 3, k = 3, b k = 3 3 > a . Thus, T ( n ) = Θ( n 3 ). (b) T ( n ) = 3 T ( n/ 2) + n . Ans: a = 3 , b = 2 , k = 1. Thus, a > b k . Thus, T ( n ) = Θ( n log 2 3 ). (c) T ( n ) = 4 T ( n/ 2) + n 2 . Ans: a = 4 , b = 2 , k = 2. Thus, a = b k . Thus, T ( n ) = Θ( n 2 log n ). (d) T ( n ) = T ( n/ 3) + T (2 n/ 3) + n . Ans: No. (e) T ( n ) = 4 T ( n/ 3) + n log n . Ans: Yes, by taking a = 4 , b = 3 , k = 1 + , where 1 < 1 + < log 3 4, we see that n 1 f ( n ) n 1+ , for large enough n . Thus, T ( n ) = O ( n log 3 4 ). Similarly, as f ( n ) = Ω( n ), we have that T ( n ) = Ω( n log 3 4 ). Giving us T ( n ) = Θ( n log 3 4 ). 2. Use induction to detmine the upper bound for the following recurrence relations. Express your answer in big O -notation. (a) T ( n ) = 2 + n - 1 i =1 T ( i ); T (1) = 1. Ans: We show by induction that T ( n ) 2 * 2 n , for n 1. Base case: For n = 1, the relation clearly holds.

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 ]}

Page1 / 4

t2ans - CS3230 Tutorial 2 1 Which of the following...

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

View Full Document
Ask a homework question - tutors are online