3. The Fibonacci numbers are defined by the recurrence: F(n) = F(n-1) + F(n-2); for n > 1 with initial values F(0) = 0 and F(1) = 1 (a) Draw the recursion tree T to compute F(4) (b) Write a recursive procedure to compute F(n). (c) Write a dynamic programming procedure to compute F(n). (d) Describe the asymptotic running times for your procedures of parts (b) and (c). (25 points)
Added by Vickie G.
Close
Step 1
Then, we apply the recurrence relation Fn = Fn-1 + Fn-2 to compute F(2) and F(3), and finally use the recurrence relation again to compute F(4). The recursion tree T for computing F(4) would look like this: F(4) / \ F(3) F(2) Show more…
Show all steps
Your feedback will help us improve your experience
Ashar Tanveer and 69 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
The sequence defined recursively by setting $$a_{\mathrm{n}+2}=a_{n+1}+a_{n} \quad \text { starting with } \quad a_{1}=a_{2}=1$$,is called the Fibonacci sequence. (a) Calculate $a_{3}, a_{4}, \cdots, a_{10}$ (b) Define $$r_{n}=\frac{a_{n+1}}{a_{n}}$$,$$\text { Calculate } r_{1}, r_{2}, \cdots, r_{6}$$, (c) Assume that $r_{n} \rightarrow L$, and find $L$. HINT: Rclatc $r$, to $r_{n}, 1$.
Sequences; Inderminate Forms; Improper Integrals
Some Important limits
Define the sequence $$F_{n}=\frac{1}{\sqrt{5}}\left(\frac{(1+\sqrt{5})^{n}-(1-\sqrt{5})^{n}}{2^{n}}\right)$$ a) Find the first 10 terms of this sequence and compare them to Fibonacci numbers. b) Show that $3 \pm \sqrt{5}=\frac{(1 \pm \sqrt{5})^{2}}{2}$ c) Use the result in b) to verify that $F_{n}$ satisfies the recursive definition of Fibonacci sequences.
Sequences and Series
Sequences
Let f0, f1, f2, ..., fn, ... denote the Fibonacci sequence. By evaluating each of the following expressions for small values of n, conjecture a general formula and then prove it, using mathematical induction and the Fibonacci recurrence: (a) f1 + f3 + ... + f2n-1 (b) f0 + f2 + ... + f2n (c) f0 - f1 + f2 - ... + (-1)^n fn (d) f0^2 + f1^2 + ... + fn^2
Adi S.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD