You are on page 1of 2

# Cmpe 211 / Comp 231 Popup Quiz 02

9 October 2012

## Solutions and marking

All constants and function values are strictly positive. 1. (25 points) Give a formal denition for the expression f (n) O(g (n)).

Solution
f (n) O(g (n)) means that there exist constants n0 and c such that for all n > n0 , f (n) cg (n) Dening O(g (n)) using set builder notation as a set is an equally acceptable solution.

Marking
there exist constants in the correct context 5 points. n0 and c 2.5 points each (identier names unimportant), for all n > n0 in the right context 10 points, f (n) cg (n) in the right context 5 points

## 2. (25 points) If j, k, l are constants, Is jn2 + kn + l 0(n2 ) ?

Solution
Yes

Marking
25 points.

3. (50 points) Prove your answer to the second question using the denition you gave in answer to the rst question.

Solution
Consider c = j + k + l and n0 = 1 For all n 1, 1 n n2 so jn2 + kn + l jn2 + kn2 + ln2 Therefore for all n 1, jn2 + kn + l (j + k + l)n2 and thus for all n n0 , jn2 + kn + l cn2 So the c and n0 that we have chosen satisfy the conditions to show that jn2 + kn + l 0(n2 )

Marking
c chosen 5 marks chosen c meets the condition 5 marks n0 chosen 5 marks chosen n0 meets the condition 5 marks Proof that the inequality holds for all n n0 30 marks, partial marks for inadequate proofs