Answer to Question #297194 in C for vijay

Question #297194

Use recursion tree to solve the following recurrence.


T(n) = T(n/15) + T(n/10) + 2T(n/6) + √n


1
Expert's answer
2022-02-15T10:40:20-0500
#include <stdio.h>
#include <math.h>

//T(n) = T(n/15) + T(n/10) + 2T(n/6) + √n

double recursion(float n)
{
    if (n < 1) return n;
    return recursion(n/15) + recursion(n/10) + 2 * recursion(n/6) + sqrt(n);
}

int main()
{
    float test = 10;
    double result = 0;
    
    result = recursion(test);
    
    printf("%lf", result);

    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS