5

Prove or disprove the following statements:

  1. $T\left( n \right) = 2T\left( {\frac{n}{2}} \right) + f\left( n \right),f\left( n \right) = \theta \left( {{n^2}} \right) $ then $ {\rm{ }}T\left( n \right) = \theta \left( {f\left( n \right)} \right) $ for all $ {\rm{ n = }}{{\rm{2}}^k}$

  2. $T\left( n \right) = 2T\left( {\frac{n}{2}} \right) + f\left( n \right),f\left( n \right) = \Omega \left( {{n^2}} \right) $ then $ {\rm{ }}T\left( n \right) = O\left( {f\left( n \right)} \right)$ for all $ {\rm{ n = }}{{\rm{2}}^k}$

I think I should use the third case of the master theorem to check these equations.

But I have not been able to check this constraint for these inequations:

$\qquad af\left( {\frac{n}{b}} \right) \le cf\left( n \right)$

How do I do that?

Raphael
  • 73,212
  • 30
  • 182
  • 400
sam
  • 349
  • 1
  • 2
  • 8

2 Answers2

4

The following shows that the second statement is false.

Define $f$ as follows: $$ f(n) = \begin{cases} 4n^3 & n \text{ is a power of }4, \\ n^2 & \text{otherwise}. \end{cases} $$ Let $n = 2^{2k+1}$. Then $f(n) = n^2$ while $$ T(n) \geq 2T(n/2) \geq 2f(n/2) = n^3. $$

Yuval Filmus
  • 280,205
  • 27
  • 317
  • 514
2

For 1., trouble is that you don't know $f$; it could be any one of the functions in $\Theta(n^2)$. Therefore, applying the master theorem directly is not (immediately) possible.

So let's unfold $\Theta$! Let $f \in \Theta(n^2)$ arbitrary. We know by definition of $\Theta$ that there are $d_1, d_2, n_1, n_2 \in \mathbb{N}$ such that

$\qquad \displaystyle d_1n^2 \leq f(n) \leq d_2n^2$,

for all $n \geq n_0 := \max(n_1,n_2)$. We will ignore all $n < n_0$ in the sequel; consider the respective values of $T$ constants.

We can easily show with the master theorem (case 3) that for

$\qquad\begin{align} T_1(n) &= 2T_1(n/2) + d_1n^2 \text{ and} \\ T_2(n) &= 2T_2(n/2) + d_2n^2 \end{align}$

both $T_1 \in \Theta(n^2)$ and $T_2 \in \Theta(n^2)$. Since we have (asymptotically) that $T_1(n) \leq T(n) \leq T_2(n)$, we also get that $T \in \Theta(n^2) = \Theta(f)$ by squeeze theorem.


As you see, we needed both upper and lower bound to perform the proof. We don't have that in the second case where $f \in \Omega(n^2)$. That suggests the statement may be false (but does not prove it).

Once we suspect, we can choose a counter-example; see Yuval's answer for one.

Raphael
  • 73,212
  • 30
  • 182
  • 400