Skip to content

Commit

Permalink
#167 4-4h
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtask committed Apr 30, 2024
1 parent 5f6ce55 commit b2c6c55
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion chapter4/problems/4/h.tex
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
\workinprogress % TODO
Let $n_0>0$ be the implicit threshold constant, and let $d>0$ be another constant such that $T(n)\le d$ for all $n<n_0$.
We'll prove by induction that
\[
\lg(n!)-\lg(n_0!) < T(n) \le \lg(n!)+d
\]
for all $n>0$.

Let $0<n<n_0$.
It follows that $0\le\lg(n!)<\lg(n_0!)$, and thus $\lg(n!)-\lg(n_0!)<0\le T(n)\le d\le\lg(n!)+d$.

For the inductive case let $n\ge n_0$ and suppose that
\[
\lg((n-1)!)-\lg(n_0!) < T(n-1) \le \lg((n-1)!)+d.
\]
We have
\begin{align*}
T(n) &= T(n-1)+\lg n \\
&> \lg((n-1)!)-\lg(n_0!)+\lg n \\
&= \lg((n-1)!\cdot n)-\lg(n_0!) \\
&= \lg(n!)-\lg(n_0!)
\end{align*}
and
\begin{align*}
T(n) &= T(n-1)+\lg n \\
&\le \lg((n-1)!)+d+\lg n \\
&= \lg((n-1)!\cdot n)+d \\
&= \lg(n!)+d,
\end{align*}
thereby completing the inductive proof.

By the bounds shown above and by equation (3.28), we obtain $T(n)=\Theta(\lg(n!))=\Theta(n\lg n)$.

0 comments on commit b2c6c55

Please sign in to comment.