Homework 2
Assigned on Monday 19th th October 2026,
due in three weeks on Monday, the 9th November 2026
Upload a single pdf file for each homework assignment via
the Blackboad site for the course.
Problems 2.29 , 2.34 , 2.37 , 2.40 from Chapter 2
*AND* the following
problem:
In problem 2.29 the textbook shows the C code to evaluate
the n-th Fibonacci number.
Write/copy that C code into a file; then compile it (with gcc) ;
and then run the executable to evaluate the value of
fib(n) for n = 10, 20, 30, 40, 50, 60, 70, 80, 90 and 100.
For each value of the argument n, track the amount of time it
takes to evaluate the fib(n) function;
and plot it (the execution time)
as a function of n (i.e., the values of n on the x axis and
the execution time on the y axis.
is there a problem?
If so, then explain what the problem is and modify the code to
fix (i.e. circumvent / avoid) that problem.
Otherwise, state that you did not encounter any problem.