Published on

The Algorithm Design Manual (3rd) Exercise Solution 'E2-22'

Table of Contents

Introduction

This series is my solutions for algorithm exercises in'The Algorithm Design Manual' 3rd edition.
It's my solutions, not model answers, so if you find some mistakes or more sophisticated solutions, please post in comment area below.

Repository

Here

Exercise 2-22

Question

Show that for any real constants aa and bb, b>0b > 0

(n+a)b=ʘ(nb)\begin{equation} (n+a)^b=ʘ(n^b) \end{equation}

Solution

There are at least two distinct approaches for this problem.

The solution by normal inequation relations

For large enough nn, nn satisfies the following inequation:

nmax{2a,2a}\begin{equation} n \ge max\{-2a, 2a\} \end{equation}

[1] In that time, nn and aa satisfies a inequation and both hands of the statement is greater than or equal to 0.

n2n+a\begin{equation} \frac{n}{2} \le n+a \end{equation}

Raise to the both sides:

(n2)b(n+a)b\begin{equation} \left(\frac{n}{2}\right)^b \le (n+a)^b \end{equation}

So,

(n+a)b=Ω(nb)\begin{equation} (n+a)^b=\Omega(n^b) \end{equation}

[2] For large enough n, nan \ge a, so,

(n+a)b(n+n)b=2bnb\begin{equation} (n+a)^b \le (n+n)^b=2^bn^b \end{equation}

So,

(n+a)b=O(nb)\begin{equation} (n+a)^b=O(n^b) \end{equation}

[1] and [2] derives:

(n+a)b=ʘ(nb)\begin{equation} (n+a)^b=ʘ(n^b) \end{equation}

The solution using the result of the previous exercise 2-21

Using binomial expansion to (n+a)b(n+a)^b, we get the following statement:

(n+a)b=nb+i=0b1aini\begin{equation} (n+a)^b=n^b+\sum_{i=0}^{b-1}a_in^i \end{equation}

The result of exercise 2-21 says the second term of the left-hand side in above equation is O(nb1)O(n^{b-1}).
So,

(n+a)b=nb+i=0b1aini=Θ(nb)+O(nb1)=Θ(nb)(the answer)\begin{align} (n+a)^b&=n^b+\sum_{i=0}^{b-1}a_in^i\\ &=\Theta(n^b)+O(n^{b-1})=\Theta(n^b)\:\text{(the answer)} \end{align}