edited by
207 views
0 votes
0 votes

The running time of an algorithm $T(n)$, where $n$ is the input size, is given by following:

$T(n) = \begin{cases} 8T(n/2) + qn & \text{ if } n>1 \\  p & \text{ if } n = 1 \end{cases}$

where $p$ and $q$ are constants, the order of algorithm is

  1.  $n^2$
  2.  $n^3$
  3.  $n$
  4.  $n^n$
edited by

1 Answer

1 votes
1 votes

$T(n) = 8T(n/2) + qn$  if  n>1

           $= p $            if n=1

$p$ and $q$ are constants

Now, according to Master's Theorem ,

$T(n)$ = $aT(n/b) + n^c$     if $n>1$

           = $d$                if  $n = 1$

& if $log_ba$ $>c$ , then $T(n)$ = $Θ(n^{log_b a})$

 

In this recurrence relation, $a = 8$ & $b = 2$ and $c=1$

∴ $log_ ba$ = $log_ 28$ = 3

 Here, $log_ ba > c$ ,

So, order will be $T(n) = Θ(n^{log_b a})$ = $Θ(n^{3})$

edited by

Related questions

1 votes
1 votes
1 answer
1
gatecse asked Mar 2, 2018
193 views
Let $T_1(n) = O (f(n))$ and $T_2(n) = O (g(n))$, then ${T_1(n)}.{T_2(n)}$ will be$O(f(n).g(n))$ $O(f(n))+O(g(n))$$O(f(n))-O...
0 votes
0 votes
1 answer
3
gatecse asked Mar 2, 2018
347 views
The solution that satisfies all constraints of the given problem and either maximizes or minimizes a given objective function is called ________ solution.greedyfeasibleop...
0 votes
0 votes
2 answers
4
gatecse asked Mar 2, 2018
756 views
Bluetooth uses ____ method in physical layer to avoid interference from other devices or other networksFHSSFDSSTDSNone of the above