Category : Pascal Source Code
Archive   : FIBONAC.ZIP
Filename : FIBONAC.DOC

 
Output of file : FIBONAC.DOC contained in archive : FIBONAC.ZIP
**********************************************************************
You should have the following files in the arc file :


Fibonac.pas - Fibonacci source.

Fibonac.com - In case you do not have turbo pascal you can still
work with the idea of Fibonacci sequence.

Fibonac.doc - Fibonacci introduction.
**********************************************************************


This program was written to turn our attention
to the idea of fibonacci sequences. This program illustrates
that a recursive routine may call itself a number of times
with different arguments. In fact, as long as a recursive
routine uses only local variables, the programmer can use
the routine just as he uses any other and assume that it
performs its function and produces the desired value. You
need not worry about the underlying stacking mechanism.


RECURSION stack operation for fibonacci function :

N X Y Pass

6 * *
---------------- 1

5 * *
6 * *
---------------- 2

4 * *
5 * *
6 * *
---------------- 3

3 * *
4 * *
5 * *
6 * *
---------------- 4

2 * *
3 * *
4 * *
5 * *
6 * *
---------------- 5

1 * *
2 * *
3 * *
4 * *
5 * *
6 * *
---------------- 6

2 1 *
3 * *
4 * *
5 * *
6 * *
---------------- 7

0 * *
2 1 *
3 * *
4 * *
5 * *
6 * *
---------------- 8

0 * *
2 1 *
3 * *
4 * *
5 * *
6 * *
---------------- 9

2 1 0
3 * *
4 * *
5 * *
6 * *
---------------- 10

3 1 *
4 * *
5 * *
6 * *
---------------- 11

1 * *
3 1 *
4 * *
5 * *
6 * *
---------------- 12

3 1 1
4 * *
5 * *
6 * *
---------------- 13

4 2 *
5 * *
6 * *
---------------- 14

2 * *
4 2 *
5 * *
6 * *
---------------- 15

1 * *
2 * *
4 2 *
5 * *
6 * *
---------------- 16

0 * *
2 1 *
4 2 *
5 * *
6 * *
---------------- 17

2 1 0
4 2 *
5 * *
6 * *
---------------- 18

4 2 1
5 * *
6 * *
---------------- 19

5 3 *
6 * *
---------------- 20

3 * *
5 3 *
6 * *
---------------- 21

The rest of the stack operation is left for you
to finish as an excercise.



  3 Responses to “Category : Pascal Source Code
Archive   : FIBONAC.ZIP
Filename : FIBONAC.DOC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/