Recent questions tagged recursion

0 votes
0 answers
123
0 votes
1 answer
124
What will be the output? for foo(4) 4332221234 4332221324 43222214 4332211223
0 votes
1 answer
125
how static affects in this program?
5 votes
2 answers
126
Consider the following functionVoid func(int n){Int k=n;Int i=0;for(;i<n;i++){while(k>1){k>>=1;}}What is the worst case time complexity of the function?
0 votes
1 answer
130
2 votes
0 answers
131
What is the time complexity of the following code snippet? Assume x is a global variable and “statement” takes O(n) time?
0 votes
2 answers
132
1 votes
1 answer
133
A binary search algorithm is implemented using recurrsionthen what is the space and time complexity?
1 votes
1 answer
134
0 votes
2 answers
135
What is the value of F(n, m)?Function F(n, m : integer) : integer; begin if(n <= 0) or (m <= 0) then F:=1 else F := F(n-1, m) + F(n, m-1); end;
2 votes
0 answers
136
$T(n) = 1/n\sum T(I) + 1.$Sum ranges fromI=1 to i=n-1
3 votes
2 answers
137
Question no 11.
3 votes
3 answers
138
int fun(int n) { int s=0,i; if(n<=1) return 1; for(i=1; i*i<n; i++) s+=n; return fun(n/4)+fun(n/4)+s; } what will be the time complexity, returning value and no. of recur...
1 votes
3 answers
139
#include <stdio.h void f(int); int main() { int a=4; f(a); return 0; } void f(int n) { if(n>0) { f( n); printf("%d", n); f( n); } }Explain how function calls take place
0 votes
0 answers
140
how to Write a program in C which implements tower of Hanoi using recursion? and please explain lines of code if possible.It 'll be a great help.
0 votes
5 answers
141
#include <stdio.h int f(int n) { if(n ≤ 1) return 1; if(n%2 = = 0) return f(n/2); return f(n/2) + f(n/2+1); } int main() { printf("%d", f(11)); return 0; }(a) Stack Ove...
1 votes
2 answers
142
int f(int n) { static int i = 1; if (n ≥ 5) return n; n = n + i; i++; return f(n); }The value returned by f(1) is:(a) 5 (b) 6(c) 7 (d) 8 need solution with explaination...
0 votes
1 answer
145
Write a recursive backtracking solution for placing $3$ rooks in $6^*6$ chess board.Naive backtracking.Try using bitmask to speed it up.
2 votes
4 answers
146
output of program:void function(int); void main() { function(3); } void function(int num){ if(num>0) { function( num); printf("%d",num); function( num); } }will the argum...
0 votes
1 answer
149
How many times $fibon$$\left ( 3 \right )$ is called during invocation of $fibon$ $\left ( 6 \right )$?$fibon(x) = fibon(x-1) + fibon(x-2)$$fibon(0) = 1$$fibon(1) = 1$345...
0 votes
1 answer
150