94 - 100 A 89.5 - 93.9 A- 86 - 89.4 B+ 83 - 86.4 B 78 - 82.9 B-
45 - 50 14 40 - 44.5 7 35 - 39.5 1 29 - 34.5 2
for i := 1 to 2n do
for j := 1 to 2n do
x := x + 1
The number of execution is 4n2.
i := n
while i >= 1 do
begin
for j := 1 to n-1 do
x := x + 1
i := i / 2
end
The number of execution is (lgn + 1)(n - 1). Several people seem to have thought the j's index goes up to i - 1 instead of n - 1.
Prove that, if f(x) = O(g(x)), then f(x) + g(x) = O(g(x)).
Many people said f(x) <= c1*g(x) and g(x) <= c2*g(x). The second one is NOT assumed in the question. I only gave a full credit if you explicitly stated the assumption that g(x) = O(g(x)). Also, many answers had something like g(x) <= c2*x. That's incorrect.
T(n) = 3*T(n-1) - 2*T(n-2)
Some people tried (unsuccessfully) to use iteration method. This form requires the characteristic equation method.