Professional Documents
Culture Documents
2012 2013 Comp 231 Quiz 02 Solutions
2012 2013 Comp 231 Quiz 02 Solutions
9 October 2012
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
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