in Algorithms retagged by
2,090 views
1 vote
1 vote
Consider the following function
find (int n)
{
if (n < 2 ) then return;
else
{
sum= 0;
for (i= 1; i ≤ 4; i++)

find (n/2);
for (i=1; i≤ n*n; i++)
sum= sum + 1;
}
}
Assume that the division operation takes constant time and “sum” is global variable. What is the time complexity of “find (n)” ?
in Algorithms retagged by
2.1k views

4 Comments

I think $\Theta (n^2 logn)$
0
0
yes, an answer is given same, get ?how did you get?
0
0
Recurrence Relation for above code is T(n) = 4T(n/2) + n^2

Solve this you will get :)
2
2
i didnt got that please explain
0
0

1 Answer

2 votes
2 votes

T (n)= $\theta (n^2logn)$

Related questions

2 votes
2 votes
1 answer
4
samarpita asked in Algorithms Dec 29, 2021
652 views
samarpita asked in Algorithms Dec 29, 2021
652 views