Summer 2003: Algorithm Library Design

Homework 2: Tuesday, 29.04.03

due Thursday , 08.05.03, 4pm (before class)
Submit homeworks to Roman Dementiev <dementiev@mpi-sb.mpg.de>. Source code only, no executables!

Exercise 2 (10 Pts)

Lets define the n-th Fibonacci number fn as follows:

Program a template program in C++ that computes at compile time the n-th Fibonacci number and writes its value encoded in some compiler output message (e.g., error message) for all n from 1 to m for a fixed given m. The example prime.C might be of help.

What do you think of the compilation time with respect to the parameter m (big-O calculus)? What would be your computational model (assumptions about the compiler)?


Lutz Kettner (<surname>@mpi-inf.mpg.de). Last modified on Tuesday, 17-Jan-2006 17:53:40 MET.