Java Reference
In-Depth Information
Factorial
return 1;
Factorial
return 1*Factorial(0);
.
.
.
.
Factorial
return 10*Factorial(9);
main
Factorial(10);
Figure 3.3
Visualizing the function call
stack for the recursive factorial function.
function call stack
3.5.2 Fibonacci sequences
Fibonacci sequences were introduced by Leonard de Pise
1
as the following
sequence
F
i
}
i
of natural numbers:
F
i
=
1 for
i
=1or
i
=2,
F
i−
1
+
F
i−
2
otherwise.
The first Fibonacci numbers are given by 1
,
1
,
2
,
3
,
5
,
8
,
13
,
21
,
34
,
55
...
Fibonacci
sequences are important for studying the characteristics of
population growth
under a basic model. Let us explain this model for a population of male/female
rabbits:
{
-
First, put a newly born pair of male/female rabbits in an enclosed field.
-
Assume that newly born rabbits take a month to become mature, after which
time...
-
... Each pair of mature rabbits produces a new pair of baby rabbits every
month.
1
Leonard de Pise (1170-1245) is better known as Fibonacci.
Search WWH ::
Custom Search