retagged by
11,132 views
2 votes
2 votes
The running time of an algorithm T(n), where ‘n’ is the input size, is given by— T(n)=8⌈(n/2)+qn,if n>1⌉=p,if n=1
where p, q are constants. The order of this algorithm is—
(a) n2 (b) nn
(c) n3 (d) n
retagged by

3 Answers

1 votes
1 votes

Thank you @Anirudh sir for the correction..!!  //Question was not clearly typed before. Thank for updating :)
Assuming that the question given is T(n )= 8 (n/2) + qn

n log 2 8 = n3

and using Masters theorem, T(n) = Θ(n 3 )

edited by
0 votes
0 votes
answer given is n3 i.e,(c) but not know the reason
0 votes
0 votes

$T(n)=8T(\frac{n}{2})+qn$

Using master's theorem, we'll compare this will the standard formula:

$T(n)=aT(\frac{n}{b})+\theta(n^klog^pn)$, we find that
 $a=8, b=2, k=1,p=0$, and $a>b^k$

The Order of the recurrence becomes 

$\theta(n^{log_ba})\rightarrow\theta(n^{log_28})=\theta(n^3)$

Option (C).

Related questions

1 votes
1 votes
0 answers
1
syncronizing asked Mar 15, 2019
1,298 views
Is this the correct way to solve ?Q) int algorithm(int n){ int sum =0;k,j; for (k=0;k<n/2;k++) for(j=0;j<10;j++) sum++; return 4*algorithm(n/2)*algorit...
1 votes
1 votes
1 answer
2
VikramRB asked Jan 20, 2019
1,041 views
What is the time complexity of the following recurrence relation and step to derive the same$T(n) = T(\sqrt{n}) + log(logn)$
0 votes
0 votes
0 answers
4
garvit_vijai asked Nov 17, 2018
467 views
How to solve the following recurrence relation?T(n) = T(n-6) + n2 , n>7T(n) = 1 , n<= 7