CS 600 Solutions to Homework 1





1. Textbook p. 58: 3-2 all



a. $\lg^{k} n = O(n^{\epsilon})$ and $o(n^{\epsilon})$
For $\lim_{n \rightarrow \infty} \lg^{k} n /n^{\epsilon}$= $\lim_{n \rightarrow \infty} (k/n\ln 2)\lg^{k-1} n /\epsilon n^{\epsilon - 1}$
= $\lim_{n \rightarrow \infty} k\lg^{k-1} n /\epsilon \ln 2 n^{\epsilon}$
= $\lim_{n \rightarrow \infty} k! /(\epsilon \ln 2 )^{k}n^{\epsilon}$
= 0



b. nk = O(cn) and o(cn)
For $\lim_{n \rightarrow \infty} n^{k}/c^{n} $= $\lim_{n \rightarrow \infty} kn^{k-1}/c^{n} \ln c$
= $\lim_{n \rightarrow \infty} k(k-1)n^{k-2}/c^{n} \ln^{2} c$
= $\lim_{n \rightarrow \infty} k!/ c^{n} \ln^{k} c$
= 0



c. None of them applies.
For nsin n oscillates between n (> n1/2) and 1/n (< n1/2). Hence no C or n0 can be found for O, $\Omega$, o, or $\omega$.



d. 2n/2 = O(2n) and o(2n).
For $\lim_{n \rightarrow \infty} 2^{n/2}/2^{n}$ = 0 $\lim_{n \rightarrow \infty} 1/2^{n/2}$ since 2n = 2n/2 2n/2.



e. $n^{\lg m} = \Theta (m^{\lg n})$, $O(m^{\lg n})$, and $\Omega (m^{\lg n})$, where m should read c.
For they are equal by one of the properties of $\log$ function.



f. $\lg (n!) = \Theta (\lg (n^{n}) )$, $O(\lg (n^{n}) )$, and $\Omega (\lg (n^{n}) )$.
For $\lg (n!) = \Theta (n \lg n)$ from p.55 and $\lg (n^{n}) = n \lg n$.



Proving $\lg (n!) = \Theta (n \lg n)$ is quite complex involving integrals. See for example p. 9 of S. Baase, Computer Algorithms, 2nd ed., Addison-Wesley, 1988.



2. Textbook p.75:
4.3 - 1 all
a. Since a = 4 and b = 2, $\log_{b} a = 2$. Hence this is case 1 of Master Theorem.
Hence $T(n) = \Theta (n^{2})$.



b. Since a = 4 and b = 2, $\log_{b} a = 2$. Hence this is case 2 of Master Theorem.
Hence $T(n) = \Theta (n^{2} \lg n)$.



c. Since a = 4 and b = 2, $\log_{b} a = 2$.
Also c = 1/2 satisfies the inequality condition of case 3 of Master Theorem because $4 (n/2)^{3} \leq 1/2 n^{3}$. Hence this is case 3 of Master Theorem.
Hence $T(n) = \Theta (n^{3})$.



4.3 - 3
Since a = 1 and b = 2, $\log_{b} a = \lg 1 = 0$. Hence $n^{\log_{b} a} = n^{0} = 1 = \Theta (1)$.
Hence this falls into case 2 of Master Theorem.
Hence $T(n) = \Theta (\lg n )$.



4.3 - 5
Take $T(n) = T(n/2) + n^{\mid \sin n \mid + 1}$.
Check to see that this satisfies all the conditions of case 3 of Master Theorem except the regularity condition.