CSC 510 Some Notes on Complexity Categories
1. To show g(n) e O(f(n)
Find yvalues ofc > O and N 2 0 such that g(n) S c X f(n) for all n 2 N.
Example: Show n2 e 0(n2); let C = 1 and N = 1; then n2 S 1 x n2 for all n 2 1.
(c = 26 and N = 105 would also work
Some problems to devise algorithms for:
1. DesignerGenes, Inc., a biotech company, is studying replication rates of various
types of bacteria. Of particular interest is one type which, during a certain time
interval
J V \ / A
26. What is the time complexity T(n) of the nested loops below? For simplicity,
you may assume that n is a power of 2. That is, n ? 2 for some positive
integer k.
for (i = 1; i<= 1),; i+)cfw_
j = n; ' .
While (j >= 1)cfw_
< body of the while loo