Two different implementations for obtaining the nth Fibonacci number.
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
Fibonacci.java
README.md
fibonacci.rb

README.md

Fibonacci Numbers

This is a simple library of Fibonacci number solvers. Each implementation has two algorithms.

Algorithms

Fast

This implementation figures out each number sequentially, holding on to only the last two. Complexity: O(N)

Slow

This implementation calls itself recursively until it gets to the first and second numbers. Complexity: O(2^N)

Usage

Ruby

ruby fibonacci.rb <number> [number...]

Java

javac Fibonacci.java
java Fibonacci <number> [number...]