You are on page 1of 2

15-211 Quiz 1 Page 1 of 2

15-211 : Fundamental Data Structures and Algorithms


Quiz 1
January 28, 2009

Name: Solution

Andrew ID:

Section:

Answer the questions clearly in the space provided following each question. Be sure to read the
directions to each question carefully. You have 20 minutes. Good Luck!

Question Points Score


1 25
2 75
Total: 100

1. Proof : Let T (n) = n2 − 1 and f (n) = 1.


(10) (a) Prove that T (n) 6= O(f (n)). Your proof should be as rigorous as the similar proof you
saw in recitation.

Assume for sake of contradiction that T (n) = O(f (n)). Then, there must exist some
constants c, n0 > 0 such that ∀n > n0 , n2 − 1 ≤ c. Let N = max{c + 1, n0 } + 1. Because
N > n0 , N 2 − 1 ≤ c, so N 2 ≤ c + 1. However, N > c + 1 and N > 0, so N 2 > c + 1. We
have a contraction, so no such c, n0 could exist, so T (n) 6= O(f (n)).

(10) (b) Prove that T (n) = Ω(f (n)). Be sure to provide any constants in the asymptotic definitions.

T (n) = Ω(f (n)) if and only if there exists some constant c, n0 > 0 such that ∀n > n0 ,
n2 − 1 ≥ c. Let c = 3 and n0 = 1. Thus, n ≥ 2, so n2 ≥ 4, so n2 − 1 ≥ 3 = c. Thus,
T (n) = Ω(f (n)).

(5) (c) Prove that T (n) 6= Θ(f (n))

T (n) = Θ(f (n)) if and only if T (n) = Ω(f (n)) and T (n) = O(f (n)). However, by part a,
T (n) 6= O(f (n)), so T (n) 6= Θ(f (n)).
15-211 Quiz 1 Page 2 of 2

2. Big-Oh Multiple Choice : Circle ALL answers that apply, not just the tightest bounds.
(15) (a) T (n) = 2 log n + 32n log n

O(log n) O(n) O(n log n) O(n2 ) O(n2 log n)

Ω(log n) Ω(n) Ω(n log n) Ω(n2 ) Ω(n2 log n)

Θ(log n) Θ(n) Θ(n log n) Θ(n2 ) Θ(n2 log n)

(15) (b) T (n) = 4n3 − 16n2 + 256n + 1

O(log n) O(n) O(n2 ) O(n3 ) O(n4 )

Ω(log n) Ω(n) Ω(n2 ) Ω(n3 ) Ω(n4 )

Θ(log n) Θ(n) Θ(n2 ) Θ(n3 ) Θ(n4 )

(15) (c) T (n) = 1 + 2 + 3 + · · · + n

O(log n) O(n) O(n2 ) O(n3 ) O(n4 )

Ω(log n) Ω(n) Ω(n2 ) Ω(n3 ) Ω(n4 )

Θ(log n) Θ(n) Θ(n2 ) Θ(n3 ) Θ(n4 )

(15) (d) T (1) = 1


T (n) = T ( n2 ) + n

O(1) O(n) O(log n) O(n log n) O(n2 )

Ω(1) Ω(n) Ω(log n) Ω(n log n) Ω(n2 )

Θ(1) Θ(n) Θ(log n) Θ(n log n) Θ(n2 )

(15) (e) T (1) = 1


T (n) = T (n − 1) + 1

O(1) O(n) O(n2 ) O(n3 ) O(n4 )

Ω(1) Ω(n) Ω(n2 ) Ω(n3 ) Ω(n4 )

Θ(1) Θ(n) Θ(n2 ) Θ(n3 ) Θ(n4 )

You might also like