retagged by
740 views

1 Answer

Best answer
2 votes
2 votes
T(n)=2T(n/2) + n/log(n)

T(n/2)=2T(n/4) + (n/2)/(log n/2)

Substituting back in first equation,

T(n)=2^2T(n/2^2) + n/log(n/2) + n/log(n)

Now we can generalize the above as:

T(n)=2^k T(n/2^k) + n/log(n/2^k-1) + n/log(n/2^k-2) + . . . + n/log(n/2) + n/log(n)

Assuming T(1) =1,

then, k=log(n).

Now the equation becomes,

T(n)=n.(1) + n [ 1/1 + 1/2 + ... + 1/k-1 + 1/k] /// here i have reduced 1/log(n/2^k-1) to 1/1 as 2^k=n and log2 =1.

T(n) = n+n[log(k)]

Substituting value of k as log(n), we get,

T(n)= n + nlog(log(n)).

Hence complexity is O(n.loglogn).

We can verify this by master's theorem also. (It will come under case 2 in it.)
selected by

Related questions

3 votes
3 votes
1 answer
1
sumit_kumar asked Jun 25, 2017
3,141 views
what is time comlexity procedure for following recursive equation by substitution method:T(n)= T(n-1)+T(n-2) , if n>=2 =1 , if n=1; =0 , if n=0.
2 votes
2 votes
1 answer
2
0 votes
0 votes
1 answer
3
iarnav asked May 15, 2017
374 views
somewhere at the end solving a recursive equation we get like - 2^n+2^n-1+2^n-2+......+2^0Someone please simplify in layman terms how come from 2^0 to 2^n we have (n+1) t...
1 votes
1 votes
0 answers
4
syncronizing asked Mar 15, 2019
1,294 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...