samedi 24 juin 2017

Time complexity for recursive function with random input

I'm a beginner in C programming so i need some help for my time complexity function.

int function(int n)
{ if (n <= 1)
    return n;
int i = random(n-1);
return test(i) + test(n - 1 - i);
}

I don't know how to deal with this problem because of the random function which have O(1) complexity which return randomly numbers.




Aucun commentaire:

Enregistrer un commentaire