Department of Computer Science | Institute of Theoretical Computer Science | CADMO

Theory of Combinatorial Algorithms

Prof. Emo Welzl and Prof. Bernd Gärtner

unsigned int fib(unsigned int n) // POST: Rueckgabe ist die n-te Fibonacci-Zahl F_n, wobei // F_0:=0, F_1:=1 und F_i:=F_{i-1}+F_{i-2}, fuer i>1. { if (n == 0) return 0; if (n <= 2) return 1; return fib(n-1) + fib(n-2); } // fib(n)