1

In given:
$${T(n)=4T(\frac{n-2}{2}) +n^2 }$$ How can i find ${O(T(n))}$ ?

Software_t
  • 153
  • 5

1 Answers1

4

Let $S(n) = T(4n-2)$. Then $$ S(n) = T(4n-2) = 4T\left(\frac{4n-4}{2}\right) + \Theta(n^2) = 4T(2n-2) + \Theta(n^2) = 4S(n/2) + \Theta(n^2). $$ The master theorem tells us that $S(n) = \Theta(n^2\log n)$, and so $T(n) = \Theta(n^2\log n)$.

More generally, the statement of the Akra–Bazzi theorem (specifically, the $h_i$ functions) makes it clear that the small perturbation in this recurrence ($\frac{n-2}{2}$ instead of $\frac{n}{2}$) doesn't change the asymptotics of the solution. From this theorem you can derive the solution directly without guessing the substitution $S(n) = T(4n-2)$.

Yuval Filmus
  • 276,994
  • 27
  • 311
  • 503
  • Thank you!! In addition, can you give motivation for how to know how to define ${"The- S(n)"}$ ? – Software_t Apr 07 '17 at 14:15
  • 1
    You look for a function $f(n)$ that satisfies $\frac{f(n)-2}{2} = f(n/2)$. Given a value for $f(1)$, you can calculate $f(n)$ for all powers of 2, and if you're lucky, the function has a simple expression in terms of $n$. – Yuval Filmus Apr 07 '17 at 14:29