edited by
1,299 views
1 votes
1 votes

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

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

$ = p,$ if $n = 1$

Where $p,q$ are constants. The order of this algorithm is

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

1 Answer

1 votes
1 votes

We can directly apply master’s theorem on this to get T(n).

T(n) = aT(n/b)+ f(n) a>=1, b>1
and
If f(n) is Ɵ(n^d) d>=0

then,
if a<b^d then T(n) = Ɵ(n^d)
elif a==b^d then T(n) = Ɵ(n^d logn)
elif a>b^d then T(n) = Ɵ(n^(logab)

Here,

a = 8; b = 2; d = 1

and, a>$b^{d}$

Therefore,

T(n) = Ɵ(n$\log_{a} b$) = Ɵ(n$\log_{2} 8$) = Ɵ($n^{3}$)

Answer:

Related questions

0 votes
0 votes
0 answers
1
1 votes
1 votes
1 answer
2
1 votes
1 votes
3 answers
4
admin asked Apr 1, 2020
1,014 views
An algorithm is made up of two modules $M1$ and $M2.$ If order of $M1$ is $f(n)$ and $M2$ is $g(n)$ then he order of algorithm is$max(f(n),g(n))$$min(f(n),g(n))$$f(n) + g...