Skip to main content
tags and proper casing (considering this is a 10K+ views question)
Source Link
Jake
  • 3.8k
  • 20
  • 35

Using the following recursive Fibonacci algorithm:

def fib(n):
   if n==0:
      return 0
   elif n==1
      return 1
   return (fib(n-1)+fib(n-2))

If I inputtedinput the number 5 to find fib(5), I know this will output 5 but how do I examine the complexity of this algorithm? How do I calculate the steps involved?

Using the following recursive Fibonacci algorithm:

def fib(n):
   if n==0:
      return 0
   elif n==1
      return 1
   return (fib(n-1)+fib(n-2))

If I inputted the number 5 to find fib(5), I know this will output 5 but how do I examine the complexity of this algorithm? How do I calculate the steps involved?

Using the following recursive Fibonacci algorithm:

def fib(n):
   if n==0:
      return 0
   elif n==1
      return 1
   return (fib(n-1)+fib(n-2))

If I input the number 5 to find fib(5), I know this will output 5 but how do I examine the complexity of this algorithm? How do I calculate the steps involved?

tags and proper casing (considering this is a 10K+ views question)
Source Link

Complexity of recursive fibonacciFibonacci algorithm

Using the following recursive fibonacciFibonacci algorithm:

def fib(n):
   if n==0:
      return 0
   elif n==1
      return 1
   return (fib(n-1)+fib(n-2))

if i inputedIf I inputted the number 5 to find fib of 5(5), iI know this will equaloutput 5 but how do iI examine the complexity of this algorithm? How do iI calculate the steps involved?

Complexity of recursive fibonacci algorithm

Using the following recursive fibonacci algorithm:

def fib(n):
   if n==0:
      return 0
   elif n==1
      return 1
   return (fib(n-1)+fib(n-2))

if i inputed the number 5 to find fib of 5, i know this will equal 5 but how do i examine the complexity of this algorithm? How do i calculate the steps involved?

Complexity of recursive Fibonacci algorithm

Using the following recursive Fibonacci algorithm:

def fib(n):
   if n==0:
      return 0
   elif n==1
      return 1
   return (fib(n-1)+fib(n-2))

If I inputted the number 5 to find fib(5), I know this will output 5 but how do I examine the complexity of this algorithm? How do I calculate the steps involved?

Tweeted twitter.com/#!/StackCompSci/status/385106978718351360
Source Link
joker
  • 469
  • 1
  • 5
  • 15

Complexity of recursive fibonacci algorithm

Using the following recursive fibonacci algorithm:

def fib(n):
   if n==0:
      return 0
   elif n==1
      return 1
   return (fib(n-1)+fib(n-2))

if i inputed the number 5 to find fib of 5, i know this will equal 5 but how do i examine the complexity of this algorithm? How do i calculate the steps involved?