Recent questions tagged recursion

1 votes
3 answers
37
#include <stdio.h>int f(int n){ static int r = 0; if (n <= 0) return 1; r=n; return f(n-1) + r;}int main() { printf("output is %d", f(5)); return 0;}Ou...
1 votes
2 answers
43
What is the time complexity of the below mentioned recursive function.int f(n){ if(n!=1){ return f(n/2)+f(n/2);}elsereturn 10;} O(n)O(n^2)O(log n)O(n logn)
5 votes
3 answers
45
4 votes
3 answers
46