Int sum(int n)
{
If(n==1)
return 1;
else
return n+sum(n-1);
}
a) T(n) = T(n/2) + n
b) T(n) = T(n-1) + n
c) T(n) = T(n-1) + O(1)
d) T(n) = T(n/2) + O(1)
What will be the recurrence relation of the following code?
-
answerhappygod
- Site Admin
- Posts: 899604
- Joined: Mon Aug 02, 2021 8:13 am
What will be the recurrence relation of the following code?
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!