Experiments with Fibonacci and memoization.
Ruby
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.mdown update readme with information on other Ruby programs in this repo Apr 19, 2014
benchmarks.rb adjust maximum fibonacci number to taste Apr 21, 2014
fib_calculator.rb add memory efficient solution by Jack Watson-Hamblin Apr 19, 2014
fibo-bhu.rb
fibo-memo.rb consider merging into master Jan 27, 2015
fibo-raw.rb Convert fibs to classes Apr 19, 2014
fibo-tr.rb Convert fibs to classes Apr 19, 2014
fibo-varyform.rb shorter memoization version by Varyform Apr 17, 2014

README.mdown

Fibonacci and Memoization

Sample code mentioned in the Recursion and Memoization blog post. This is a comparison of two recursive Fibonacci programs (fibo-memo.rb and fibo-raw.rb) written in Ruby. One uses memoization, and the other does not.

The remaining Ruby programs in this repo were written by other developers, noted in each file. Each looks at the problem in a different way.

By definition...

  • Fibonacci numbers are always positive integers.
  • The n th number in a fibonacci sequence is f(n). f(n) = f(n-1) + f(n-2)
  • The first two numbers of the sequence are 0 and 1, or 1 and 1 depending on the chosen starting point of the sequence.