lab_dict
Devious Dictionaries: Cleverness Through Association
 All Classes Namespaces Files Functions Variables
fib.cpp File Reference

Contains Fibonacci-number generating functions both utilizing and not utilizing memoization. More...

Functions

unsigned long fib (unsigned long n)
 Calculates the nth Fibonacci number where the zeroth is defined to be 0. More...
 
unsigned long memoized_fib (unsigned long n)
 Calculates the nth Fibonacci number where the zeroth is defined to be 0. More...
 

Detailed Description

Contains Fibonacci-number generating functions both utilizing and not utilizing memoization.

Author
Matt Joras
Date
Winter 2013

Function Documentation

unsigned long fib ( unsigned long  n)

Calculates the nth Fibonacci number where the zeroth is defined to be 0.

Parameters
nWhich number to generate.
Returns
The nth Fibonacci number.
unsigned long memoized_fib ( unsigned long  n)

Calculates the nth Fibonacci number where the zeroth is defined to be 0.

This version utilizes memoization.

Parameters
nWhich number to generate.
Returns
The nth Fibonacci number.