Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged recursion
0
votes
2
answers
91
GeeksForGeeks
Find time complexity of below Program? A(n){ if(n<=1) return; else return $A(\sqrt{n})$ ; }
Find time complexity of below Program?A(n){if(n<=1) return;elsereturn $A(\sqrt{n})$ ;}
Rustam Ali
898
views
Rustam Ali
asked
Sep 3, 2018
Algorithms
time-complexity
recursion
geeksforgeeks-test-series
+
–
2
votes
1
answer
92
gate forum
nag.swarna
565
views
nag.swarna
asked
Sep 2, 2018
Programming in C
recursion
+
–
1
votes
2
answers
93
pseudo code
int zap(int n) { if (n<=1) then zap =1; else zap = zap(n-3)+zap(n-1); } then the call zap(6) gives the values of zap Give the proper explanation
int zap(int n){if (n<=1) then zap =1;else zap = zap(n-3)+zap(n-1);}then the call zap(6) gives the values of zapGive the proper explanation
shivam sharma 5
1.4k
views
shivam sharma 5
asked
Aug 28, 2018
Programming in C
programming-in-c
recursion
+
–
0
votes
0
answers
94
recursion"what is the output of the program"
#include <stdio.h> void fun(int); typedef int (*pf) (int ,int ); int proc(pf, int ,int); int main() { int a = 3; fun(a); return 0; } void fun(int n) { if (n>0) { fun(--n); printf("%d,", n); fun(--n); } }
#include <stdio.h>void fun(int);typedef int (*pf) (int ,int );int proc(pf, int ,int);int main(){ int a = 3; fun(a); return 0; }void fun(int n){ if (n>0) ...
shivam sharma 5
6.4k
views
shivam sharma 5
asked
Aug 27, 2018
Programming in C
recursion
+
–
2
votes
2
answers
95
Linked list
How to trace the below program? p and q are the starting address of two different linked list struct node*Do(struct node*p,struct node*q){ struct node*ps,*qs; if(!p){ return(q); } else if(!q){ return(p); } else{ ps=p->link; qs=q->link; p->link=q; q->link=Do(ps,qs); return(p); } }
How to trace the below program?p and q are the starting address of two different linked list struct node*Do(struct node*p,struct node*q){ struct node*ps,*qs; if(!p...
rishabhgupta12
916
views
rishabhgupta12
asked
Aug 3, 2018
Programming in C
linked-list
recursion
+
–
3
votes
3
answers
96
geeksforgeeks
#include <stdio.h> int main() { static int i=5; if(--i) { main(); printf("%d ",i); } }
#include <stdio.h int main() { static int i=5; if( i) { main(); printf("%d ",i); } }
Rudra Pratap
1.8k
views
Rudra Pratap
asked
Jul 20, 2018
Programming in C
programming-in-c
recursion
+
–
2
votes
2
answers
97
Recursion
int f (int n){ if (n==0) return 0; if(n==1) return 1; else return f(n-1)+f(n-2); } Find the upper bound and lower bound to the number of function calls for input size 'n'?
int f (int n){ if (n==0) return 0; if(n==1) return 1;elsereturn f(n-1)+f(n-2);}Find the upper bound and lower bound to the number of function ...
parasghai28
2.0k
views
parasghai28
asked
Jul 8, 2018
Programming in C
recursion
functions
programming-in-c
+
–
1
votes
1
answer
98
Recursion
void ab() { auto int a; static int s= 5; a = ++s; printf("%d%d",a,s); if(a<= 7) ab(); printf("%d%d",a,s); } void main() { ab(); } According to me answer should be- 667788887766 but the answer is - 667788887868. Please explain
void ab() { auto int a; static int s= 5; a = ++s; printf("%d%d",a,s); if(a<= 7) ab(); printf("%d%d",a,s); } void main() { ab(); }According to me answer should be- 6677888...
parasghai28
1.0k
views
parasghai28
asked
Jul 8, 2018
Programming in C
recursion
programming-in-c
+
–
1
votes
1
answer
99
#C Recursion Question (A variance of Gate 2018) Question
Consider the following program written in pseudo-code. Assume that x and y are integers. Count (x, y) { if (y !=2 ) { if (x !=1) { print("*"); Count (x/2, y); } else { y=y-1; Count (1024, y); } } } The number of times ... ================================= My answer is 10220 and I just need someone to verify if it's correct.
Consider the following program written in pseudo-code. Assume that x and y are integers. Count (x, y) { if (y !=2 ) { if (x !=1) { ...
iarnav
835
views
iarnav
asked
Jun 28, 2018
Programming in C
programming-in-c
numerical-answers
recursion
+
–
2
votes
2
answers
100
data structure
To remove recursion from a program we have to use which of the following data structure? array stack queue list
To remove recursion from a program we have to use which of the following data structure?arraystackqueuelist
eyeamgj
2.2k
views
eyeamgj
asked
Jun 18, 2018
DS
data-structures
recursion
stack
+
–
1
votes
0
answers
101
Time Complexity
What will be the time complexity of the following algorithm ? A(n){ if(n<=1) return 1; for(i=1;i<n;i++){ for(j=0;j<3;j++){ A(n-1) } } }
What will be the time complexity of the following algorithm ?A(n){if(n<=1) return 1;for(i=1;i<n;i++){ for(j=0;j<3;j++){ A(n-1) } }}
kartikeya2812
399
views
kartikeya2812
asked
Jun 16, 2018
Algorithms
time-complexity
algorithms
asymptotic-notation
recursion
+
–
1
votes
0
answers
102
GATE Suitability Test | Test 1 | Question: 11
Consider the following C program? void mystery(int n){ if(n<=0) return; printf("%d", 0); mystery(n-1); mystery(n-2); } int main(){ int n=10; mystery(n); return 0; } The number of ‘0’s printed by above program is ?
Consider the following C program?void mystery(int n){ if(n<=0) return; printf("%d", 0); mystery(n-1); mystery(n-2); } int main(){ int n=10; mystery(n); return 0; }The num...
Arjun
154
views
Arjun
asked
Jun 10, 2018
Algorithms
gate-suitability-test-1
recursion
numerical-answers
+
–
7
votes
3
answers
103
Time complexity , Recursion
Why is recursive equation of following code $T(n)=T(n/2)+O(1)$, not $T(n)=8*T(n/2)+O(1)$? int x=0; int A(n) { if(n==1) return 1; else { X+=8A(n/2)+n^3; } return X; }
Why is recursive equation of following code $T(n)=T(n/2)+O(1)$, not $T(n)=8*T(n/2)+O(1)$? int x=0; int A(n) { if(n==1) return 1; else { X+=8A(n/2)+n^3; } return X; }
bts
1.9k
views
bts
asked
May 29, 2018
Algorithms
recursion
time-complexity
algorithms
master-theorem
+
–
0
votes
1
answer
104
Time Complexity
int lcs_length(char * A, char * B) { if (*A == '\0' || *B == '\0') return 0; else if (*A == *B) return 1 + lcs_length(A+1, B+1); else return max(lcs_length(A+1,B), lcs_length(A,B+1)); } what is worst case time complexity of $\text{lcs_length}$ if size of $A$ is $m$ and size of $B$ is $n$? O($2^{m+n}$) O($2^{n}$) O($2^{mn}$) O($2^{max(m,n)}$) none of these
int lcs_length(char * A, char * B) { if (*A == '\0' || *B == '\0') return 0; else if (*A == *B) return 1 + lcs_length(A+1, B+1); else return max(lcs_length(A+1,B), lcs_le...
hacker16
413
views
hacker16
asked
Apr 28, 2018
Algorithms
time-complexity
recursion
algorithms
+
–
0
votes
0
answers
105
Recursion Tree
What is the max height of recursion tree of recurrence $c(100,50)$? here, the recursive function is defined as $c(n,k) = c(n-1,k-1) + c(n,k-1)$ terminating condition $c(n,n) = 1, c(n,0) = 1$.
What is the max height of recursion tree of recurrence $c(100,50)$?here, the recursive function is defined as$c(n,k) = c(n-1,k-1) + c(n,k-1)$terminating condition$c(n,n) ...
hacker16
482
views
hacker16
asked
Apr 28, 2018
Algorithms
algorithms
recursion
dynamic-programming
+
–
2
votes
1
answer
106
ISRO2018-69
Let $P$ be a procedure that for some inputs calls itself (i.e. is recursive). If $P$ is guaranteed to terminate, which of the following statement(s) must be true? $P$ has a local variable $P$ has an execution path where it does not call itself $P$ either refers to a global variable or has at least one parameter I only II only III only II and III only
Let $P$ be a procedure that for some inputs calls itself (i.e. is recursive). If $P$ is guaranteed to terminate, which of the following statement(s) must be true?$P$ has ...
Arjun
1.8k
views
Arjun
asked
Apr 22, 2018
Programming in C
isro2018
programming
recursion
+
–
0
votes
1
answer
107
SAnfoundary
What data structure would you most likely see in a non-recursive implementation of a recursive algorithm? Linked List Stack Queue Tree please explain also
What data structure would you most likely see in a non-recursive implementation of a recursive algorithm?Linked ListStack QueueTreeplease explain also
Moin Mukhtar
1.2k
views
Moin Mukhtar
asked
Mar 23, 2018
Programming in C
data-structures
recursion
+
–
0
votes
1
answer
108
Printing elements of linked-list using recursion.
Can anyone check this program? I got some warning. #include<stdio.h> #include<stdlib.h> void func(struct node *); struct node { int data; struct node *next; }; int main() { struct node *head=(struct node *)malloc(sizeof(struct node)); ... void func(struct node *p) { if(p) { printf("\n%d",p->data); func(p->next); } }
Can anyone check this program?I got some warning.#include<stdio.h>#include<stdlib.h>void func(struct node *); struct node{ int data; struct node *next;}; int ...
Ahsanul Hoque
583
views
Ahsanul Hoque
asked
Mar 6, 2018
Programming in C
programming-in-c
recursion
linked-list
+
–
35
votes
7
answers
109
GATE CSE 2018 | Question: 45
Consider the following program written in pseudo-code. Assume that $x$ and $y$ are integers. Count (x, y) { if (y !=1 ) { if (x !=1) { print("*"); Count (x/2, y); } else { y=y-1; Count (1024, y); } } } The number of times that the $print$ statement is executed by the call $Count(1024, 1024)$ is _____
Consider the following program written in pseudo-code. Assume that $x$ and $y$ are integers.Count (x, y) { if (y !=1 ) { if (x !=1) { print("*"); Count (x/2, y); } else {...
gatecse
13.3k
views
gatecse
asked
Feb 14, 2018
Algorithms
gatecse-2018
numerical-answers
algorithms
recursion
2-marks
+
–
23
votes
5
answers
110
GATE CSE 2018 | Question: 21
Consider the following $\text{C}$ program: #include<stdio.h> int counter=0; int calc (int a, int b) { int c; counter++; if(b==3) return (a*a*a); else { c = calc(a, b/3); return (c*c*c); } } int main() { calc(4, 81); printf("%d", counter); } The output of this program is ______.
Consider the following $\text{C}$ program:#include<stdio.h int counter=0; int calc (int a, int b) { int c; counter++; if(b==3) return (a*a*a); else { c = calc(a, b/3); re...
gatecse
11.2k
views
gatecse
asked
Feb 14, 2018
Programming in C
gatecse-2018
programming-in-c
numerical-answers
recursion
programming
1-mark
+
–
0
votes
1
answer
111
recursion
did recursion is bottom up approach to problem solving?
did recursion is bottom up approach to problem solving?
kd.....
410
views
kd.....
asked
Feb 9, 2018
Programming in C
recursion
+
–
4
votes
1
answer
112
MadeEasy Test Series 2018: Programming & DS - Recursion
sumit chakraborty
675
views
sumit chakraborty
asked
Jan 28, 2018
Algorithms
programming
recursion
made-easy-test-series
+
–
5
votes
3
answers
113
MadeEasy Test Series 2018: Programming & DS - Recursion
Abhishek Kumar Singh
1.3k
views
Abhishek Kumar Singh
asked
Jan 18, 2018
Programming in C
programming
recursion
made-easy-test-series
+
–
5
votes
0
answers
114
Time Complexity
T(n) $\leq$ T($\frac{n}{5}$) + T($\frac{7n}{10}$) + 15n T(n) $\leq$ 5 when n $<$ 6
T(n) $\leq$ T($\frac{n}{5}$) + T($\frac{7n}{10}$) + 15nT(n) $\leq$ 5 when n $<$ 6
Mk Utkarsh
424
views
Mk Utkarsh
asked
Jan 9, 2018
Algorithms
time-complexity
algorithms
asymptotic-notation
recursion
+
–
4
votes
0
answers
115
Recurrence equation
What is the highest upper bound time complexity for the following recurrence equation: $T(n)=4T\left ( \frac{n}{2} \right ) +n^{2}2^{\frac{1}{2}}$
What is the highest upper bound time complexity for the following recurrence equation: $T(n)=4T\lef...
Aakanchha
836
views
Aakanchha
asked
Jan 8, 2018
Algorithms
algorithms
time-complexity
recurrence-relation
recursion
+
–
9
votes
1
answer
116
T(n) = T(n/4) + T(3n/4) +n
How to solve above recurrence relation (With substitution method)??
How to solve above recurrence relation (With substitution method)??
anoop yadav 2
13.5k
views
anoop yadav 2
asked
Jan 8, 2018
Algorithms
algorithms
master-theorem
recurrence-relation
time-complexity
recursion
+
–
1
votes
1
answer
117
binary search space complexity
Aditya Bahuguna
2.5k
views
Aditya Bahuguna
asked
Jan 7, 2018
Algorithms
binary-search
recursion
space-complexity
test-series
+
–
2
votes
0
answers
118
Recursion Stack
My doubt is, In the stack, we will push [main()->PTN(3)->PTN(2)->PTN(1)->PTN(0)] PTN = printTwoNumbers function call Then according to answer PTN(0) won't pushed into stack, but at least to check if and return we should push it. What's the correct. My answer is 5, given is 4
My doubt is, In the stack, we will push [main()->PTN(3)->PTN(2)->PTN(1)->PTN(0)] PTN = printTwoNumbers function callThen according to answer PTN(0) won't pushed int...
Ashwin Kulkarni
735
views
Ashwin Kulkarni
asked
Jan 5, 2018
DS
data-structures
stack
recursion
+
–
2
votes
0
answers
119
Recursion
State which one is true 1) Every left recursive grammar can be converted to right recursive grammar 2) Every right recursive grammar can be converted to left recursive grammar 3) Recursion use static storage
State which one is true1) Every left recursive grammar can be converted to right recursive grammar2) Every right recursive grammar can be converted to left recursive gram...
srestha
568
views
srestha
asked
Dec 28, 2017
Compiler Design
recursion
compiler-design
+
–
3
votes
1
answer
120
C Recursion
Abhishek Kumar Singh
1.1k
views
Abhishek Kumar Singh
asked
Dec 24, 2017
Programming in C
recursion
programming-in-c
+
–
Page:
« prev
1
2
3
4
5
6
7
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register