Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

fibonacci of 6

f(n) = f(n-1) + f(n-2) 
                                  f(6)
                                   ^
  			                       /
                f(5)               +                       f(4)
                ^
               /                   +                        /
                
        f(4)    +           f(3)                     f(3)    +    f(2)
       ^                       ^                     ^              ^
      /                       /                    /            /
   
 f(3)   +       f(2)            f(2) + f(1)       f(2) + f(1)   f(1) +  f(0)             
   ^              ^                ^                ^
   /             /                /              /
    
f(2) + f(1)      f(1) +  f(0)     f(1)+ f(0)       f(1) + f(0)         
  ^
  /
f(1) +  f(0) 
  
//f(6) = 8   ==>  f(1)*8    f(1) appears 8 times 
 double feb  = (1/Math.pow(5,0.5)) * (Math.pow((1+Math.pow(5,0.5))/2,n)) - (1/Math.pow(5,0.5))* (Math.pow((1-Math.pow(5,0.5))/2,n));  
  
f(1) == 1;   
  
  
  
  
  
  
  
Comment

PREVIOUS NEXT
Code Example
Java :: one line hashmap java 
Java :: java stream add to existing list 
Java :: java exception override message 
Java :: firebase realtime database get key 
Java :: java continue statement 
Java :: 1 elemenet array java 
Java :: java map key set 
Java :: get current location android 
Java :: how to get filename without extension in java 
Java :: Java Creating an EnumMap 
Java :: java indexof nth occurrence 
Java :: call by value and call by reference in java 
Java :: mergesort java 
Java :: java linked list swap elements 
Java :: how to find lcm of two numbers java 
Java :: lambda expression java 
Java :: java log4j example 
Java :: comments java 
Java :: java to kotlin converter android studio 
Java :: array in java 
Java :: one key with multiple values map java 
Java :: configure JWT on Springboot 
Java :: android studio tabbed activity 
Java :: abstract class java 
Java :: eclipse versioning .classpath 
Java :: how todo a timeout test java 
Java :: foreach() java 
Java :: javax.net.ssl.trustStore trustall 
Java :: How to define lambda expression in Java? 
Java :: internal hashcode 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =