4.b Algorytm rekurencyjny obliczania F(n)
0 dla n = 0 Obliczmy kilka pierwszych
F(n) = < 1 dla n = l wyrazów ciągu.
[F(n-1)+ F(n 2) dla n >l[
») = u
F(1) = 1
F(2) = F(1) + F(0) = 1 + 0 = 1 F(3) = F(2) + F(1) = (F(1) + F(0)) + F(1) = 1 + 0 +1 = 2 I F(4) = F(3) + F(2) = (F(2) + F(1)) + (F(1) + F(0)) = „
IL (F(1) + F(0)+F(1)) + (F(1) + F(0)) = 1 + 0+1+1 + 0 = 3 i If(5) = F(4) + F(3) = (F(3) + F(2)) + (F(2) + F(1)) =
= (F(2) + F(1) + F(1) + F(0)) + (F(1) + F(0) + F(1)) =........
i F(6) = F(5) + F(41 = (F(4) + F(3)) + (F(3) + F(2))
ILlEiaLhHas Bil+F<m+(F(2i+Fm+F(1)+F(0»