cs161: Data Structures and Algorithms Handout #3 Michael Goldwasser Stanford University Tuesday, June 25, 1996

Homework #1: Asymptotics and Sorting Due Date: Tuesday, 2 July 1996

Reading

Read carefully Ch. 1 and Ch. 2 of CLR.

Practice

Recall, these exercises are purely for your own practice. You need only turn in the official problems.

• Do CLR 1.2-3.

• Do CLR 1.2-6.

• Do CLR 1.4-1.

• Do CLR 2.1-2, 2.1-3.

• Do CLR 2.2-4. [can you do this without Stirling’s approximation?]

Problems

1. Do CLR 1-2.

2. Do CLR 1.3-6.

3. Do CLR 2-4. [Your proofs must be formal]

4. Rank the following functions by order of growth, i.e., find an arrangement g_{1}, g_{2}, …, g_{25} of the functions satisfying g_{1} = Ω(g_{2}), g_{2} = Ω(g_{3}), …, g_{24} = Ω(g_{25}). Partition your list into equivalence classes such that f(n) and g(n) are in the same class iff f(n) = Θ(g(n)). [Note: We do not require proof for this problem, simply the ordering and the equivalence classes.]

(3/2)^{n} (\sqrt{2})^{lg n} lg^{∗} n  n^{2}  (lg n)!
n^{3}  lg^{2} n lg(n!) 2^{2^{n}} n^{1/ lg n}
lg lg n n · 2^{n} n^{lg lg n} ln n  2^{n}
2^{lg n} (lg n)^{lg n} 4^{lg n} (n + 1)! \sqrt{lg n}
n!  2^{\sqrt{2 lg n}}  n  n lg n  1

Extra Credit

Do CLR 1.3-7.