midsol08 - University of Toronto ECE-345 Algorithms and...

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

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.

Unformatted text preview: University of Toronto ECE-345: Algorithms and Data Structures Solutions to Midterm Examination (Fall 2008) 1. (a) False. 2 3 n +1 = 2 3 · 3 n = (2 3 ) 3 n = 8 3 n , which is clearly not O (2 3 n ) (compare the limits as n → ∞ ). (b) True. Take the limit of n 2 / n 3 lg n as n → ∞ . We get lg n n , which tends to 0. Therefore, n 2 = O ( n 3 lg n ). (c) Base case: n = 1 holds easily. Induction Hypothesis: Assume statement holds for n . Induction Step: Consider statement for n +1. The LHS of the statement becomes equal to (- 1) n +1 parenleftBig n ( n +1) 2 parenrightBig + (- 1) n +2 ( n +1) 2 by Induction Hypothesis. This is equal to (- 1) n +2 (- k ( k +1) 2 +( k +1) 2 ) = (- 1) n +2 ( ( k +1)( k +2) 2 ), which is the LHS of the statement for n + 1. Thus, the statement holds for n + 1. (d) 65 / \ 22 77 / \ 5 37 / 2 \ 4 (e) Master theorem doesn’t apply here. Draw recursion tree. At each level, do Θ( n ) work. Number of levels on one side is log 5 / 4 n = Θ(lg n ), on the other side is log...
View Full Document

This note was uploaded on 01/29/2012 for the course ECE 345 taught by Professor Veneris during the Fall '10 term at University of Toronto.

Page1 / 2

midsol08 - University of Toronto ECE-345 Algorithms and...

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

View Full Document
Ask a homework question - tutors are online