Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged recursion
5
votes
3
answers
61
GO Classes 2023 | Weekly Quiz 4 | Question: 20
What will be output printed by $\text{mystery}2(6)$? void mystery2(int n) { if (n > 0) { printf("%d", n); mystery2(n-2); mystery2(n-3); printf("%d", n); } }
What will be output printed by $\text{mystery}2(6)$?void mystery2(int n) { if (n 0) { printf("%d", n); mystery2(n-2); mystery2(n-3); printf("%d", n); } }
GO Classes
531
views
GO Classes
asked
Mar 26, 2022
Programming in C
goclasses_wq4
goclasses
programming
programming-in-c
recursion
numerical-answers
1-mark
+
–
4
votes
3
answers
62
GO Classes 2023 | Weekly Quiz 4 | Question: 21
What will be the output printed by $\text{mystery}3(6)$? void mystery3(int n) { if (n == 0 || n == 1) return; mystery3(n-2); printf("%d", n); mystery3(n-1); }
What will be the output printed by $\text{mystery}3(6)$?void mystery3(int n) { if (n == 0 || n == 1) return; mystery3(n-2); printf("%d", n); mystery3(n-1); }
GO Classes
589
views
GO Classes
asked
Mar 26, 2022
Programming in C
goclasses_wq4
goclasses
programming
programming-in-c
recursion
numerical-answers
1-mark
+
–
5
votes
3
answers
63
GO Classes 2023 | Weekly Quiz 4 | Question: 22
Consider the following pair of mutually recursive functions. What does $g(g(2))$ evaluate to? int f(int n){ if (n==0) return 0; return f(n-1)+g(n-1); } int g(int n){ if (n==0) return 1; return g(n-1) + f(n); }
Consider the following pair of mutually recursive functions. What does $g(g(2))$ evaluate to?int f(int n){ if (n==0) return 0; return f(n-1)+g(n-1); } int g(int n){ if (n...
GO Classes
897
views
GO Classes
asked
Mar 26, 2022
Programming in C
goclasses_wq4
goclasses
programming
programming-in-c
recursion
numerical-answers
2-marks
+
–
9
votes
2
answers
64
GO Classes 2023 | Weekly Quiz 4 | Question: 23
Consider the following recursive function. What is $f(0)?$ int f(int x) { if (x > 1000) return x - 4; else return f(f(x+5)); }
Consider the following recursive function. What is $f(0)?$int f(int x) { if (x 1000) return x - 4; else return f(f(x+5)); }
GO Classes
639
views
GO Classes
asked
Mar 26, 2022
Programming in C
goclasses_wq4
goclasses
programming
programming-in-c
recursion
numerical-answers
2-marks
+
–
0
votes
1
answer
65
Time complexity calculation
A complete binary tree is a binary tree whose all levels except the last level are completely filled and all the leaves in the last level are all to the left side. for example: Now, assume that, each of the nodes in this tree is represented by a structure struct node { ... R = R->right; } if(Lcnt == Rcnt) return 0; return func(root->left) + func(root->right); }
A complete binary tree is a binary tree whose all levels except the last level are completely filled and all the leaves in the last level are all to the left side.for exa...
dd
1.3k
views
dd
asked
Feb 10, 2022
Algorithms
algorithms
time-complexity
recursion
+
–
3
votes
1
answer
66
Applied Gate Test Series
Consider the function given below ? Assume T(0) = 0 int fun( int n ) { if ( n <= 0 ) return 0; int i = random( n - 1 ); return fun(i) + fun(n - i - 1); } random(n) returns an integer in the range [0, n] in constant time What is the time complexity of the above function? $\Theta (n^{2})$ $\Theta (n)$ $\Theta (n\log n)$ None
Consider the function given below ?Assume T(0) = 0int fun( int n ) { if ( n <= 0 ) return 0; int i = random( n - 1 ); return fun(i) + fun(n - i - 1); }random(n) returns a...
Aashay kaurav
525
views
Aashay kaurav
asked
Nov 16, 2021
Algorithms
time-complexity
algorithms
recursion
+
–
2
votes
2
answers
67
TIFR CSE 2021 | Part B | Question: 6
Consider the following pseudocode: procedure HowManyDash(n) if n=0 then print '-' else if n=1 then print '-' else HowManyDash(n-1) HowManyDash(n-2) end if end procedure How many ‘-’ does HowManyDash$(10)$ print? $9$ $10$ $55$ $89$ $1024$
Consider the following pseudocode:procedure HowManyDash(n) if n=0 then print '-' else if n=1 then print '-' else HowManyDash(n-1) HowManyDash(n-2) end if end procedureHow...
soujanyareddy13
546
views
soujanyareddy13
asked
Mar 25, 2021
Programming in C
tifr2021
programming
recursion
+
–
16
votes
3
answers
68
GATE CSE 2021 Set 2 | Question: 49
Consider the following $\text{ANSI C}$ program #include <stdio.h> int foo(int x, int y, int q) { if ((x<=0) && (y<=0)) return q; if (x<=0) return foo(x, y-q, q); if (y<=0) return foo(x-q, y, q); return foo(x, ... ); } int main( ) { int r = foo(15, 15, 10); printf( %d , r); return 0; } The output of the program upon execution is _________
Consider the following $\text{ANSI C}$ program#include <stdio.h int foo(int x, int y, int q) { if ((x<=0) && (y<=0)) return q; if (x<=0) return foo(x, y-q, q); if (y<=0)...
Arjun
8.4k
views
Arjun
asked
Feb 18, 2021
Algorithms
gatecse-2021-set2
algorithms
recursion
output
numerical-answers
2-marks
+
–
1
votes
2
answers
69
CMI-2020-DataScience-A: 1
Consider the following program. Assume that $x$ and $y$ are integers. f(x, y) { if (y != 0) return (x * f(x,y-1)); else return 1; } What is $f(6,3)?$ $243$ $729$ $125$ $216$
Consider the following program. Assume that $x$ and $y$ are integers.f(x, y) { if (y != 0) return (x * f(x,y-1)); else return 1; }What is $f(6,3)?$$243$$729$$125$$216$
soujanyareddy13
606
views
soujanyareddy13
asked
Jan 29, 2021
Algorithms
cmi2020-datascience
algorithms
recursion
identify-function
+
–
3
votes
1
answer
70
NIELIT Scientific Assistant A 2020 November: 101
What is the time complexity of the following recursive function? int ComputFun(int n) { if(n<=2) return 1; else return (ComputFun(floor(sqrt(n)))+n); } $\Theta(n)$ $\Theta(\log n)$ $\Theta(n\log n)$ $\Theta(\log \log n)$
What is the time complexity of the following recursive function?int ComputFun(int n) { if(n<=2) return 1; else return (ComputFun(floor(sqrt(n)))+n); }$\Theta(n)$$\Theta(\...
gatecse
904
views
gatecse
asked
Dec 9, 2020
Algorithms
nielit-sta-2020
algorithms
recursion
time-complexity
+
–
0
votes
1
answer
71
NIELIT 2017 OCT Scientific Assistant A (CS) - Section B: 32
Choose the correct statements. A total recursive function is also a partial recursive function A partial recursive function is also a total recursive function A partial recursive function is also a primitive recursive function None of the above
Choose the correct statements.A total recursive function is also a partial recursive functionA partial recursive function is also a total recursive functionA partial recu...
admin
1.1k
views
admin
asked
Apr 1, 2020
Theory of Computation
nielit2017oct-assistanta-cs
theory-of-computation
recursion
+
–
1
votes
5
answers
72
UGC NET CSE | January 2017 | Part 3 | Question: 24
A recursive function $h$, is defined as follows: $\begin{array} {} h(m) & =k, \text{if } m=0 \\ &=1, \text{if } m=1 \\ &= 2 h(m-1)+4h(m-2), \text{if } m \geq 2 \end{array}$ If the value of $h(4)$ is $88$ then the value of $k$ is: $0$ $1$ $2$ $-1$
A recursive function $h$, is defined as follows:$\begin{array} {} h(m) & =k, \text{if } m=0 \\ &=1, \text{if } m=1 \\ &= 2 h(m-1)+4h(m-2), \text{if } m \geq 2 \end{ar...
go_editor
1.9k
views
go_editor
asked
Mar 24, 2020
DS
ugcnetcse-jan2017-paper3
data-structures
recursion
+
–
38
votes
3
answers
73
GATE CSE 2020 | Question: 46
Consider the following C functions. int fun1(int n) { static int i= 0; if (n > 0) { ++i; fun1(n-1); } return (i); } int fun2(int n) { static int i= 0; if (n>0) { i = i+ fun1 (n) ; fun2(n-1) ; } return (i); } The return value of $\text{fun}2 (5)$ is _________
Consider the following C functions.int fun1(int n) { static int i= 0; if (n 0) { ++i; fun1(n-1); } return (i); }int fun2(int n) { static int i= ...
Arjun
23.4k
views
Arjun
asked
Feb 12, 2020
Programming in C
gatecse-2020
numerical-answers
programming-in-c
recursion
2-marks
+
–
2
votes
3
answers
74
ISRO2020-59
Consider the following recursive C function that takes two arguments unsigned int rer(unsigned int n, unsigned int r){ if(n>0)return(n%r + rer(n/r,r)); else retturn 0; } What is the return value of the function $rer$ when it is called as $rer(513,2)$? $9$ $8$ $5$ $2$
Consider the following recursive C function that takes two argumentsunsigned int rer(unsigned int n, unsigned int r){ if(n>0)return(n%r + rer(n/r,r)); else retturn 0; }Wh...
Satbir
1.8k
views
Satbir
asked
Jan 13, 2020
Programming in C
isro-2020
programming
normal
recursion
+
–
0
votes
1
answer
75
Self Doubt:Infinite loop
#include<iostream> using namespace std; int i=0; void a() { i+=1; cout<<i<< ".hello"<<endl; a(); } int main() { a(); } For this above code the output is only upto → 64891.Hello Does this mean that that the stack can hold only 64891 recursive calls? (I am using dev c++)
#include<iostream using namespace std; int i=0; void a() { i+=1; cout<<i<< ".hello"<<endl; a(); } int main() { a(); }For this above code the output is only upto → 6489...
Hirak
1.2k
views
Hirak
asked
Jun 2, 2019
Programming in C
algorithms
programming-in-c
recursion
+
–
4
votes
3
answers
76
ME MOCK 4
Consider the following function: void madeeasy (int n) { if (n < 0) return; else { printf(n); madeeasy (- -n); madeeasy (n - -); printf(n); } } The sum of all values printed by madeeasy (5)_______ (I am getting -12 but given answer is 52)
Consider the following function:void madeeasy (int n) { if (n < 0) return; else { printf(n); madeeasy (- -n); madeeasy (n - -); printf(n); } }The sum of all values printe...
newdreamz a1-z0
1.7k
views
newdreamz a1-z0
asked
Jan 30, 2019
Programming in C
programming-in-c
recursion
made-easy-test-series
+
–
1
votes
0
answers
77
MadeEasy Full Length Test 2019: Programming & DS - Recursion
Number of times # will be printed on foo(7) ?
Number of times # will be printed on foo(7) ?
Na462
870
views
Na462
asked
Jan 12, 2019
Programming in C
programming
recursion
made-easy-test-series
+
–
5
votes
2
answers
78
GATE Overflow | Mock GATE | Test 1 | Question: 25
Consider the function: int fun(int n) { if (n==4) return n; else return 2*fun(n+1); } A MOD-16 ripple counter is holding the count $(1001)_2.$ What will be the count after "$(\text{fun}(2)+15)_{10}$" clock pulses? $(1000)_2$ $(1010)_2$ $(1011)_2$ $(1101)_2$
Consider the function:int fun(int n) { if (n==4) return n; else return 2*fun(n+1); }A MOD-16 ripple counter is holding the count $(1001)_2.$ What will be the count after ...
Ruturaj Mohanty
1.4k
views
Ruturaj Mohanty
asked
Dec 27, 2018
Digital Logic
go-mockgate-1
digital-logic
ripple-counter-operation
data-structures
recursion
+
–
0
votes
2
answers
79
GATE Overflow | Mock GATE | Test 1 | Question: 26
Consider the two given functions: int fun1(int x, int y) { if (y==0) return 0; return (x+fun2(x, y-1)); } int fun2(int x, int y) { if (x==0) return y; return fun2(x-1, x+y); } What will be the value returned by $\text{fun1}(4, 4)$ ____
Consider the two given functions:int fun1(int x, int y) { if (y==0) return 0; return (x+fun2(x, y-1)); } int fun2(int x, int y) { if (x==0) return y; return fun2(x-1, x+y...
Ruturaj Mohanty
1.1k
views
Ruturaj Mohanty
asked
Dec 27, 2018
Algorithms
go-mockgate-1
numerical-answers
identify-function
recursion
algorithms
+
–
0
votes
1
answer
80
cormen 7.2 -5
Suppose that the splits at every level of quicksort are in the proportion 1 - α to α, where 0 < α ≤ 1/2 is a constant. Show that the minimum depth of a leaf in the recursion tree is approximately - lg n/ lg α ... procede with this problem i had seen stackoverflow solution but couldn't understand https://stackoverflow.com/questions/17684680/maximum-and-minimum-depth-of-quicksort
Suppose that the splits at every level of quicksort are in the proportion 1 - α to α, where 0 < α ≤ 1/2 is a constant. Show that the minimum depth of a leaf in the r...
vijju532
1.2k
views
vijju532
asked
Dec 21, 2018
Algorithms
algorithms
sorting
data-structures
recursion
cormen
+
–
2
votes
1
answer
81
output of the program
#include <stdio.h> void print(int n, int j) { if (j >= n) return; if (n-j > 0 && n-j >= j) printf("%d %dn", j, n-j); print(n, j+1); } int main() { int n = 8; print(n, 1); } (A) 1 7 2 6 3 5 4 4 4 4 (B) 1 7 2 6 3 5 4 4 (C) 1 7 2 6 3 5 (D) 1 2 3 4 5 6 7 8 Answer is B. anyone can explain how?
#include <stdio.h void print(int n, int j){ if (j >= n) return; if (n-j 0 && n-j >= j) printf("%d %dn", j, n-j); print(n, j+1);} int main(){ int n = ...
Gangani_Son
7.3k
views
Gangani_Son
asked
Dec 11, 2018
Programming in C
programming-in-c
programming
recursion
+
–
0
votes
0
answers
82
made easy
Absence of terminating condition in a recursing program cause the following with time error:) a.)array out of bounds b)stack overflow c)Null pointer access d) Divsion by zero
Absence of terminating condition in a recursing program cause the following with time error:)a.)array out of bounds b)stack overflowc)Null pointer access ...
Piyush mishra
570
views
Piyush mishra
asked
Nov 25, 2018
Algorithms
recursion
+
–
1
votes
0
answers
83
Gradeup
Why 2n is added as n-1 & n-2 functions has been called
Why 2n is added as n-1 & n-2 functions has been called
twin_123
381
views
twin_123
asked
Nov 19, 2018
Algorithms
recursion
time-complexity
+
–
1
votes
2
answers
84
Recursion
What is Head recursion and Tail Recursion??
What is Head recursion and Tail Recursion??
Lakshman Bhaiya
643
views
Lakshman Bhaiya
asked
Oct 22, 2018
Programming in C
data-structures
recursion
+
–
0
votes
1
answer
85
Solve this Q
Consider the following C code segment int f (int x) { if (x < 1) return 1; else return (f(x-1) + g(x)) } int g (int x) { if (x < 2) return 2; else return (f(x-1) + g(x/2)); } Of the following, which best describes the growth of f(x) as a function of x? (A) Linear (B) Exponential (C) Quadratic (D) Cubic
Consider the following C code segmentint f (int x) { if (x < 1) return 1; else return (f(x-1) + g(x)) } int g (int x) { if (x < 2) return 2; else return (f(x-1) + g(x/2))...
kallu singh
636
views
kallu singh
asked
Sep 7, 2018
Algorithms
time-complexity
recursion
+
–
Page:
« prev
1
2
3
4
5
6
7
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register