lab_dict
Devious Dictionaries: Cleverness Through Association
Functions
fib.cpp File Reference

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

#include "fib.h"
#include <map>

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.