Site hosted by Angelfire.com: Build your free website today!
                             Add Url             Borders             Chat             Hits             Home             Mail             Photos             Search
Edinboro
Edinboro Tragedy
Exotic Car Page
Links Page
Fortunecity Page
McDonalds Page
Non-Smoker Page
Profile
Racism
Resume
Rock Climbing Page
Sayings
Shout-Outs
Sponsors
Swingers
Taponline Page
Wellsboro
Computer Related
Algorithms
      Sorts
      Binary Search
      Fibonacci
CGI
Computer Links
Disk Storage
Hacking
Java Info
SIMM's
Win 98
Y2K
Fibonacci Numbers



1, 2, 3, 4, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584, ....n
1.Example of Fibonacci Numbers using bad use of recursion.

Unsigned long int
Factorial(const unsigned long int N)
{
   if (N < =1)
     return 1;
   else
     return N * Factorial(N-1);
}

2. Another example of bad recursion.

Unsigned long int
Fib(conts unsigned int N)
{
if (N < = 1)
  return 1;
else
   return Fib(N-1) + Fib(N-2);
}

3. Linear algorithm to computer Fibonacci Numbers.

int
Fibonacci(const unsigned int N)
{
   unsigned int Last = 1, Next_To_Last = 1, Answer;
   if (N < = 1)
     return 1;
   for (int i = 1; i < = N; i++)
   {
   Answer = Last + Next_To_Last;
   Next_To_Last = Last;
   Last = Answer;
   }    return Answer; }

4. Fibonacci Heap. The rank of any node in the head is O(Log N)



Author and Designer: Dan Vaughan
Last Update: Probably yesterday :-)

© 1998. Duplication of this material is strictly prohibitied without authorization.