Yerevan State University
Introduction to Algorithms
Homework 1
Problem 1-1. Asymptotic practice
For each group of functions, sort the functions in increasing order of asymptotic (big-O) complex-
ity:
(a)
f1 (n) = n!
f2 (n) = n(n+1)
2
f3 (n) = 2n
f4 (n) = n+1
(b)
9000000
f1 (n) = 22
f2 (n) = 2100n
f3 (n) = n(n−1)
√2
f4 (n) = n n
(c) √
f1 (n) = nn
f2 (n) = (n + 5)100000
f3 (n) = 2n · ln n
f4 (n) = 12 + 22 + · · · + n2
Problem 1-2. Asymptotic notation
(a) For the functions, nk and cn what is the asymptotic relationship between these func-
tions? Assume that k ≥ 1 and c > 1 are constants. Choose all right answers:
nk is O(cn )
nk is Ω(cn )
nk is Θ(cn )
(b) For the functions, log2 n and log8 n what is the asymptotic relationship between these
functions? Choose all right answers:
a) log2 n is O(log8 n)
b) log2 n is Ω(log8 n)
c) log2 n is Θ(log8 n)
1
(c) What is the asymptotic relationship between the functions n3 log2 n and 3n log8 n?
Choose all right answers:
a)n3 log2 n is O(3n log8 n)
b)n3 log2 n is Ω(3n log8 n)
c)n3 log2 n is Θ(3n log8 n)
(d) For the functions, 8n and 4n , what is the asymptotic relationship between these func-
tions? Choose all right answers:
a)8n is O(4n )
b)8n is Ω(4n )
c)8n is Θ(4n )
(e) For the functions, log2 nlog2 17 and log2 17log2 n , what is the asymptotic relationship
between these functions? Choose all right answers:
a) log2 nlog2 17 is O(log2 17log2 n )
b) log2 nlog2 17 is Ω(log2 17log2 n )
c) log2 nlog2 17 is Θ(log2 17log2 n )