
CPSC 2121 Name: _____________________________
Final Exam, Part 1 August 4, 2003
Closed books. Closed Notes. Calculators OK. 105 points. 90 minutes. Weight of each question in
parentheses. Please use a pencil. If you need more space, use the back of the sheet.
1. (5) Evaluate the following series:
(a) 56 + 63 + 70 + ... + 7*(N+2) =
(b) 16 + 25 + 36 + ... + (N+3)2 =
2. Your friend has analyzed Algorithms A and B, two algorithms which solve the same problem. Her analysis,
which you have checked and verified, shows that the complexity equations are as follows:
Algorithm A: f(n) = n log n Algorithm B: g(n) = 256 log n
Now answer the following questions:
_____ (a) (2) Which algorithm (A or B) would you use if the problem size is n=32?
_____ (b) (2) Which algorithm (A or B) would you use if the problem size is n=128?
(c) (6) Your friend claims that she would use Algorithm A if the problem size is less than or equal to a given value
X, and algorithm B if the problem size is greater than the same value X. Do you agree with her? If so, determine
X. Show how you arrived at your answer. If not, explain why you disagree with her.