Assignment 1 Sample Solution
1. Prove that 100000 n + 2 n3 + 100 n2 log n = (n3 ).
Ans:
Denote f (n) = 100000 n + 2 n3 + 100 n2 log n, let c1 = 2, c2 = 100102. We just
need to prove c1 n3 < f (n) < c2 n3 .
100000 n > 0, 2 n3 > 0,
100 n2 logn 0, n 1.
So 10

Cmput 204
Seminar 1 Solution Hints
1. Prove by induction that for all integer n 0: n < 2n .
Proof by induction:
Base cases:
n = 0, 0 < 20 = 1 is true.
n = 1, 1 < 21 = 2 is true.
Assumption: n < 2n for some n 1.
To show: n + 1 < 2n+1 .
Compute: 2n+1 = 2 2n

cmput 204
Seminar 2 hints
Unless stated otherwise, variables are integers.
1. Prove by counterexample that the following statement is wrong:
1000n > n log n or all integers n 1.
Proof: log n grows unboundedly (but slowly). The n terms are equal on both si

Cmput 204
Seminar 6 Hints
Feb 22+23, 2016
1. Prove directly from the definitions of O() and () that:
(a) If f (n) = O(n) and g(n) = O(n2 ), then f (n)g(n) = O(n3 )
There are positive constants c1 and c2 such that for all large enough n, f (n) c1 n and
g(n

Cmput 204
Seminar 7 Hints
Feb 29 + Mar 1, 2015
1. Randomized selection algorithm best and worst case:
For the first two parts, consider the sequence S = [13, 4, 5, 1, 17, 16, 9] and show
at each level of recursion: 1.) all your random choices of v, 2.) th

Cmput 204
Seminar 9 Hints
Mar 14+15, 2016
1. Let v1 = a, . . . , vn = b be the nodes on the path from a to b in G. This means there is an edge
(vi , vi+1 ) for each 1 i < n in G and therefore a reverse edge (vi+1 , vi ) in GR . These edges
form a path fro

cmput 204
Seminar 10 Hints
Mar21+22, 2016
1. [A], [AB], [B], [BC], [BCD], [CD], [D], [DE], [DEF ], [EF ], [F ], [ ], G, [ ], Error
2. q=[C]
d i s t a n c e =cfw_A : , B : , C : 0 , D : , E :
q=[B, D, E ]
d i s t a n c e =cfw_A : , B : 1 , C : 0 , D : 1 ,