CS209 lab10
http://www.maths.nuigalway.ie/~gettrick/teach/cs209/l10.html
-
For this lab you should submit all source code (C
files), and the result(s) of running the program on (a few)
test cases.
The source code must
be well presented (indenting, spaces, reasonable variable/function names,
etc.) and must include comments (as a rough guideline - aim to have nearly as
many comments as lines of code).
-
The above material should be given to Caitriona [caitrionakelly01@gmail.com]
before
the deadline of 5pm
Friday 2nd. April 2010. You will lose 20% for each day
(or part of day) the lab is late.
-
Plagiarism (the unattributed copying of work from other sources
(internet, fellow students,....)) will not be tolerated. Please see
http://www.nuigalway.ie/engineering/documents/plagiarism_guide_students
_v4.pdf. You risk getting zero for your lab if it is found to be
plagiarized.
Suppose we define the Fibolucci numbers to be:
- f0=0
- f1=1
- f2=2
- fn=2fn-1 + fn-2 + fn-3
for all n greater than 2.
So... the first few numbers in this sequence are 0, 1, 2, 5, 13, 33, 84,
etc.
Write a program in C that uses the binary powering method (and recursion)
to calculate the nth. Fibolucci number. Your
program can have the same structure as used in lab 9, but here, we are
dealing with a 3x3 matrix and its powers.
(The matrix in question is
)
©
NUI, Galway