A
UBB · Informatică
167

Se consideră algoritmul f(n), unde n este un număr natural (1n1061 \le n \le 10^6).

Algoritm 1

Algorithm f(n)
  If n = 0 then
    Return 1
  EndIf
  If n = 1 then
    Return 2
  EndIf
  If n MOD 2 = 0 then
    Return f(n − 1) + f(n − 2)
  Else
    Return f(n − 1) * f(n − 3)
  EndIf
EndAlgorithm

Ce va returna algoritmul pentru apelul f(8)?

17 / 37