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
Unformatted text preview: , S 2 , S 3 , ... Question #7. 1 (a) Solve the recurrence relation a n = a n1 + 1 + 2 n1 subject to the initial condition a = 1. (b) Solve the recurrence relation a n = 2 a n1 5 a n2 subject to the initial conditions a = 4, a 1 = 4. Question #8. Consider the following useless algorithm: 1 . procedure foo ( n ) 2 . if n = 1 then 3 . return 4 . x := x + 1 5 . m := n/ 2 6 . call foo ( m ) 7 . if n is even then 8 . call foo ( m ) 9 . else 10 . x := x + 1 11 . end foo Let b n denote the number of times the statement x := x + 1 is executed. (a) Determine a recurrence relation and initial conditions for the sequence { b n } . (b) Solve the recurrence relation in case n is a power of 2. Extra Credit. Using some calculus if necessary, Fnd a simpliFed expression for n k =1 k 2 2 k . 2...
View
Full
Document
 Spring '08
 WOUTERS
 Math, Algebra

Click to edit the document details