{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# hbs0(1) - CS 473 Head-Banging Session 0(January 2021 2009...

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

CS 473 Head-Banging Session 0 (January 20–21, 2009) Spring 2009 CS 473: Undergraduate Algorithms, Spring 2009 Head Banging Session 0 January 20 and 21, 2009 1. Solve the following recurrences. If base cases are provided, find an exact closed-form solution. Otherwise, find a solution of the form Θ( f ( n )) for some function f . Warmup: You should be able to solve these almost as fast as you can write down the answers. (a) A ( n ) = A ( n - 1 ) + 1, where A ( 0 ) = 0. (b) B ( n ) = B ( n - 5 ) + 2, where B ( 0 ) = 17. (c) C ( n ) = C ( n - 1 ) + n 2 (d) D ( n ) = 3 D ( n / 2 ) + n 2 (e) E ( n ) = 4 E ( n / 2 ) + n 2 (f) F ( n ) = 5 F ( n / 2 ) + n 2 Real practice: (a) A ( n ) = A ( n / 3 ) + 3 A ( n / 5 ) + A ( n / 15 ) + n (b) B ( n ) = min 0 < k < n ( B ( k ) + B ( n - k ) + n ) (c) C ( n ) = max n / 4 < k < 3 n / 4 ( C ( k ) + C ( n - k ) + n ) (d) D ( n ) = max 0 < k < n D ( k ) + D ( n - k ) + k ( n - k ) , where D ( 1 ) = 0 (e) E ( n ) = 2 E ( n - 1 ) + E ( n - 2 ) , where E ( 0 ) = 1 and E ( 1 ) = 2 (f) F ( n ) = 1 F ( n - 1 ) F ( n - 2 ) , where F ( 0 ) = 1 and F ( 2 ) = 2 ? (g) G ( n ) = n G ( p n ) + n 2 2. The Fibonacci numbers F n are defined recursively as follows: F 0 = 0, F 1 = 1, and F n = F n - 1 + F n - 2 for every integer n 2. The first few Fibonacci numbers are 0,1,1,2,3,5,8,13,21,34,55, .... Prove that any non-negative integer can be written as the sum of distinct non-consecutive Fibonacci numbers. That is, if any Fibonacci number F n appears in the sum, then its neighbors

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