Question

In C: 10. Draw the recursion tree to find out the value of f(5) int f(int...

In C:

10. Draw the recursion tree to find out the value of f(5) int f(int n)
{
int ans;
int i;
if(n<3)
return n;
ans = f(n/2);
for(i=0; i<n; i++)
ans += f(i);
return ans;
}

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here I attach the answer:

In the function call for f(5). loop with variable 'i' will iterate for 5 time through 0 to 4 . In the end ans will be computed and returns 18.

Add a comment
Know the answer?
Add Answer to:
In C: 10. Draw the recursion tree to find out the value of f(5) int f(int...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT