KUMAR SHIVAM

Explain Fibonacci Sequence ? 

Data Structures and Algorithms

Answer in Short

The Fibonacci sequence is a type series where each number is the sum of the two that precede it. It starts from 0 and 1 usually

Explanation

962    0

==> Fibonacci Sequence---

        Fibonacci series 0,1,1,2,3,5,8,13,21,…..

  1. if n=0 or n=1, then Fn =n
  2. if n>1 then Fn=Fn-1+Fn-2

         fib(n)

        {

         if(n==0)

         return 0;

         if(n==1) return 1;

         else

         return( fib(n-1)+fib(n-2));

          } 





Share:   

More Questions from Data Structures and Algorithms Module 2