Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged recursion
0
votes
0
answers
31
Best Open Video Playlist for Recursion Topic | Programming
Please list out the best free available video playlist for Recursion from programming as an answer here (only one playlist per answer). We'll then select the best playlist and add to GO classroom video lists. You can add any ... standard ones are more likely to be selected as best. For the full list of selected videos please see here
Please list out the best free available video playlist for Recursion from programming as an answer here (only one playlist per answer). We'll then select the best playlis...
makhdoom ghaya
398
views
makhdoom ghaya
asked
Aug 16, 2022
Study Resources
missing-videos
free-videos
video-links
go-classroom
recursion
+
–
1
votes
2
answers
32
Recursion
#include <stdio.h> int fun(int num) { while(num>0) { num=num*fun(num-1); } return num; } int main() { int x=fun(8); printf("%d",x); return 0; } Hello Folks, I have a doubt related to the above snippet of code. Why does the output of the above code be 0? Kindly help me with a detailed explanation.
#include <stdio.h int fun(int num) { while(num>0) { num=num*fun(num-1); } return num; } int main() { int x=fun(8); printf("%d",x); ret...
ryandany07
926
views
ryandany07
asked
Aug 15, 2022
Programming in C
programming-in-c
recursion
+
–
5
votes
3
answers
33
GO Classes Scholarship 2023 | Test | Question: 17
Consider the following pair of mutually recursive functions. int f(int n){ if (n==0) return 1; return f(n-1)+g(n-1); } int g(int n){ if (n==0) return 1; return g(n-1) - f(n); } Which of the following is/are will evaluate to TRUE? $f(2) == g(0)$ $g(2)+f(1) == 0$ $g(4)+g(1) == 0$ $f(3)+f(0) == 0$
Consider the following pair of mutually recursive functions.int f(int n){ if (n==0) return 1; return f(n-1)+g(n-1); } int g(int n){ if (n==0) return 1; return g(n-1) - f(...
GO Classes
615
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
functions
recursion
multiple-selects
2-marks
+
–
2
votes
3
answers
34
GO Classes Scholarship 2023 | Test | Question: 27
What will be the number of recursive calls for $\textsf{mystery(5)}$ including the first call? void mystery(int n) { if (n == 0 || n == 1) return 0; mystery(n-2); printf("%d", n); mystery(n-1); }
What will be the number of recursive calls for $\textsf{mystery(5)}$ including the first call?void mystery(int n) { if (n == 0 || n == 1) return 0; mystery(n-2); printf("...
GO Classes
542
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
numerical-answers
goclasses
programming
programming-in-c
recursion
1-mark
+
–
3
votes
1
answer
35
GO Classes Scholarship 2023 | Test | Question: 28
What will be the output of the following program? #include<stdio.h> struct _go{ char b[20]; char *a; struct _go *c; }x[2] = {"GATE", "2023", x+1, "GO", "Classes", x}, *p = x; typedef struct_go go; go ... ;c, n-2); } int main() { printf("%s",mystry(p,2023)->a); } GATE $2023$ Run time error GO
What will be the output of the following program?#include<stdio.h struct _go{ char b[20]; char *a; struct _go *c; }x = {"GATE", "2023", x+1, "GO", "Classes", x}, *p = x;...
GO Classes
692
views
GO Classes
asked
Aug 6, 2022
Programming in C
goclasses-scholarship-test1
goclasses
programming
programming-in-c
structure
recursion
2-marks
+
–
0
votes
1
answer
36
Recursive function
Consider the following recursive function which is used by dynamic programming. T(n) = { 0; if n<1 1; if n=1 T(n-1)+T(n-2)+1; if n>1} Assume for every function call T(i) it checks the table first , if it's value is ... of 'n' so that overflow cannot occur . ( Assume system allocate 4 byte to each stack entry which is sufficient for storing required data.)
Consider the following recursive function which is used by dynamic programming. T(n) = { 0; if n<1 1; if n=1 T(n-1)+T(n-2)+1; if n>1}Assume ...
Manisha Jaishwal
629
views
Manisha Jaishwal
asked
Aug 6, 2022
Programming in C
recursion
dynamic-programming
+
–
1
votes
3
answers
37
Which value of static variable is returned if it is present in return statement of a recursive function?
#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...
jverma
1.0k
views
jverma
asked
May 23, 2022
Programming in C
programming-in-c
recursion
self-doubt
+
–
3
votes
1
answer
38
GO Classes Test Series 2024 | Programming | Test 3 | Question: 19
#include<stdio.h> int test(int *a, int *b) { int c = *a-*b; if (c<0) return 0; else return (1 + test(&c, b)); } void main() { int x = 15; int y = 4; int a = test(&x,&y); printf("%d", a); } $2$ $3$ $4$ Run time error since we can not pass the address of local variable c in the function test.
#include<stdio.h int test(int *a, int *b) { int c = *a-*b; if (c<0) return 0; else return (1 + test(&c, b)); } void main() { int x = 15; int y = 4; int a = test(&x,&y); p...
GO Classes
364
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
functions
pointers
parameter-passing
recursion
2-marks
+
–
6
votes
3
answers
39
GO Classes Test Series 2024 | Programming | Test 2 | Question: 21
What will be the output of the following program? #include<stdio.h> int rec(int x, int y) { static int count = 0; if (x == 0) return count; count++; if (x > y) rec(x - y, y); else rec(x, y - x); return count; } main() { int i = 10, j = 2, n; n = rec(i, j); printf("%d", n); } $4$ $5$ $6$ Infinite loop
What will be the output of the following program?#include<stdio.h int rec(int x, int y) { static int count = 0; if (x == 0) return count; count++; if (x y) rec(x - y, y)...
GO Classes
381
views
GO Classes
asked
Apr 24, 2022
Programming in C
goclasses2024-programming-2-weekly-quiz
goclasses
programming
programming-in-c
recursion
output
2-marks
+
–
6
votes
1
answer
40
GO Classes Test Series 2024 | Programming | Test 2 | Question: 23
What will be the output of the program below- int i = 1; void my_extern1(void); void my_extern2(void); int main() { int count = 0; while (i++<5) { static int i = 3; i++; count +=i; my_extern1(); } printf("%d", ... (); } void my_extern2(){ extern int i; if (i++ < 3) my_extern1(); } Infinite recursion $9$ $4$ $5$
What will be the output of the program below-int i = 1; void my_extern1(void); void my_extern2(void); int main() { int count = 0; while (i++<5) { static int i = 3; i++; c...
GO Classes
319
views
GO Classes
asked
Apr 24, 2022
Programming in C
goclasses2024-programming-2-weekly-quiz
goclasses
programming
programming-in-c
recursion
output
2-marks
+
–
1
votes
1
answer
41
Applied Root Test Series
Let C(X) be the number of leaves in a binary tree rooted at T. Assume that IsLeaf(T) returns I if T is a leaf. Which of the following observations leads to a recursive implementation? C(T)=C(T.Left) +C(T.Right) C(T):C(T.Left)+C(T.Right)+1 C(T)=C(T.Left]+C(T.right)+Isleaf(T)
Let C(X) be the number of leaves in a binary tree rooted at T. Assume that IsLeaf(T) returns I if T is a leaf. Which of the following observations leads to a recursive im...
Nitesh_Yadav
297
views
Nitesh_Yadav
asked
Apr 12, 2022
Programming in C
recursion
programming-in-c
+
–
1
votes
0
answers
42
NIELIT 2022 April Scientist B | Section B | Question: 77
Consider the following two functions. void fun1(int n) { if(n == 0) return; printf("%d", n); fun2(n - 2); printf("%d", n); } void fun2(int n) { if(n == 0) return; printf(" ... %d", n); } The output printed when $\text{fun1}(5)$ is called is $53423122233445$ $53423120112233$ $53423122132435$ $53423120213243$
Consider the following two functions.void fun1(int n) { if(n == 0) return; printf("%d", n); fun2(n - 2); printf("%d", n); } void fun2(int n) { if(n == 0) return; printf("...
soujanyareddy13
661
views
soujanyareddy13
asked
Apr 12, 2022
Others
nielit2022apr-scientistb
programming
normal
tricky
recursion
+
–
1
votes
2
answers
43
Test Series
What is the time complexity of the below mentioned recursive function. int f(n) { if(n!=1) { return f(n/2)+f(n/2); } else return 10; } O(n) O(n^2) O(log n) O(n logn)
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)
Nitesh_Yadav
266
views
Nitesh_Yadav
asked
Apr 11, 2022
Algorithms
algorithms
time-complexity
recursion
test-series
+
–
2
votes
3
answers
44
GO Classes 2023 | Weekly Quiz 4 | Question: 17
How many times is foo activated (called), including the first "$\text{foo}(3,12)$" $\text{max()}$ and $\text{min()}$ are functions that return maximum and minimum respectively. int foo(int a, int b) { if (a==b) { return b; } int mn =min(a,b), mx =max(a,b); return foo(mn,mn) + foo( mx - mn , mn); }
How many times is foo activated (called), including the first "$\text{foo}(3,12)$"$\text{max()}$ and $\text{min()}$ are functions that return maximum and minimum respecti...
GO Classes
525
views
GO Classes
asked
Mar 26, 2022
Programming in C
goclasses_wq4
numerical-answers
goclasses
programming
programming-in-c
recursion
2-marks
+
–
5
votes
3
answers
45
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
513
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
46
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
563
views
GO Classes
asked
Mar 26, 2022
Programming in C
goclasses_wq4
goclasses
programming
programming-in-c
recursion
numerical-answers
1-mark
+
–
Page:
« prev
1
2
3
4
5
6
7
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register