Recursive calculation time complexity --master Theorem

We will scale a  n question, obtained by the partition of  a  one size of $  \ FRAC {n} {b}  $ sub-problems, each recursive additional computing brings to  f (n)  , then we get the following relationship formula:

$T(n)=aT(\frac{n}{b})+f(n)$,

In addition, we define a $ c_ {Crit} $  , so it is calculated:

1. When $ f (n) = O (n ^ c), and c <c_ {crit} $:

  $T(n)=\Theta(n^{c_{crit}})$

2. When $ f (n) = O (n ^ c), and c = c_ {crit} $:

  $T(n)=\Theta(n^{c_{crit}}log{n})$

3. When $ f (n)> O (n ^ c), and c = c_ {crit} $:

  $T(n)=\Theta(f(n))$

Reference links:

Time and space complexity analysis and master Theorem

Guess you like

Origin www.cnblogs.com/tldr/p/11568896.html