The Gateway to Computer Science Excellence
For all GATE CSE Questions
Toggle navigation
Facebook Login
or
Email or Username
Password
Remember
Login
Register

I forgot my password
All Activity
Questions
Unanswered
Tags
Categories
Users
Ask a Question
Prev
Blogs
New Blog
Exams
First time here? Checkout the
FAQ
!
x
×
Close
Use the google search bar on side panel. It searches through all previous GATE/other questions. For hardcopy of previous year questions please see
here
Recent questions tagged recursion
0
votes
1
answer
1
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++)
asked
Jun 2
in
Programming
by
Hirak
Active
(
3.4k
points)

87
views
algorithms
programminginc
recursion
0
votes
1
answer
2
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)
asked
Jan 30
in
Programming
by
newdreamz a1z0
Active
(
1.5k
points)

236
views
programminginc
recursion
0
votes
0
answers
3
MadeEasy Full Length Test 2019: Programming & DS  Recursion
asked
Jan 12
in
Programming
by
Na462
Loyal
(
6.7k
points)

198
views
programming
recursion
madeeasytestseries
madeeasytestseries2019
0
votes
0
answers
4
GATEBOOK2019 Grand Test DS&A25
int foo(int a, int b) { if (a%b == 0) return b; else return foo(b, a%b); } What is the output given by $foo(17, 3)$? $3$ $17$ $51$ $1$
asked
Jan 6
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

55
views
gb2019gtdsa
recursion
+1
vote
1
answer
5
output of the program
#include <stdio.h> void print(int n, int j) { if (j >= n) return; if (nj > 0 && nj >= j) printf("%d %dn", j, nj); 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?
asked
Dec 11, 2018
in
Algorithms
by
Gangani_Son
(
125
points)

147
views
programminginc
programming
recursion
algorithms
0
votes
1
answer
6
T(n) = sqrt(n) * T(sqrt(n)) + n
T(n) = sqrt(n) * T(sqrt(n)) + n Given solution is O(log log n). But my solution is O(n log log n). 'wolframalpha'' shows the answer same as mine. You can find the solution here. Can anyone confirm the solution and provide an explantion?
asked
Nov 22, 2018
in
Algorithms
by
gmrishikumar
Active
(
1.9k
points)

532
views
algorithms
recurrence
timecomplexity
recursion
0
votes
1
answer
7
MadeEasy Test Series: Programming & DS  Programming
The answer given is 27. I am getting 34. Please verify.
asked
Nov 21, 2018
in
Programming
by
Soumya29
Boss
(
15.7k
points)

220
views
madeeasytestseries
programming
recursion
0
votes
1
answer
8
Runtime Environment Heap Allocation
Does Heap Allocation support both recursion and dynamic memory allocation? Because,a stack can be implemented using dynamic memory allocation.Please correct me. Test Series answer shows only dynamic memory allocation
asked
Nov 3, 2018
in
Compiler Design
by
sripo
Active
(
2.3k
points)

156
views
compilerdesign
runtimeenvironments
operatingsystem
memorymanagement
heap
recursion
activationrecords
0
votes
2
answers
9
Recursion
What is Head recursion and Tail Recursion??
asked
Oct 22, 2018
in
Programming
by
Lakshman Patel RJIT
Boss
(
45.8k
points)

80
views
datastructure
recursion
+1
vote
1
answer
10
gate forum
asked
Sep 2, 2018
in
Programming
by
nag.swarna
(
171
points)

68
views
recursion
0
votes
1
answer
11
pseudo code
int zap(int n) { if (n<=1) then zap =1; else zap = zap(n3)+zap(n1); } then the call zap(6) gives the values of zap Give the proper explanation
asked
Aug 28, 2018
in
Programming
by
shivam sharma 5
(
31
points)

114
views
programminginc
recursion
0
votes
0
answers
12
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); } }
asked
Aug 27, 2018
in
Programming
by
shivam sharma 5
(
31
points)

162
views
recursion
+2
votes
2
answers
13
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); } }
asked
Aug 3, 2018
in
Programming
by
rishabhgupta12
(
57
points)

84
views
linkedlists
recursion
+2
votes
2
answers
14
Recursion
int f (int n){ if (n==0) return 0; if(n==1) return 1; else return f(n1)+f(n2); } Find the upper bound and lower bound to the number of function calls for input size 'n'?
asked
Jul 8, 2018
in
Programming
by
parasghai28
(
33
points)

191
views
recursion
functions
programminginc
0
votes
1
answer
15
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
asked
Jul 8, 2018
in
Programming
by
parasghai28
(
33
points)

248
views
recursion
programminginc
0
votes
1
answer
16
#C Recursion Question (A variance of Gate 2018) Question
Consider the following program written in pseudocode. Assume that x and y are integers. Count (x, y) { if (y !=2 ) { if (x !=1) { print("*"); Count (x/2, y); } else { y=y1; Count (1024, y); } } } The number of times that ... ================================== My answer is 10220 and I just need someone to verify if it's correct.
asked
Jun 28, 2018
in
Programming
by
iarnav
Loyal
(
8k
points)

207
views
programminginc
numericalanswers
recursion
0
votes
2
answers
17
data structure
To remove recursion from a program we have to use which of the following data structure? array stack queue list
asked
Jun 18, 2018
in
DS
by
eyeamgj
Loyal
(
6k
points)

314
views
datastructure
recursion
stack
+1
vote
0
answers
18
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(n1) } } }
asked
Jun 17, 2018
in
Algorithms
by
kartikeya2812
(
21
points)

108
views
timecomplexity
algorithms
asymptoticnotations
recursion
+6
votes
3
answers
19
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; }
asked
May 29, 2018
in
Algorithms
by
bts
(
119
points)

228
views
recursion
timecomplexity
algorithms
mastertheorem
0
votes
1
answer
20
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
asked
Apr 28, 2018
in
Algorithms
by
hacker16
Active
(
2.7k
points)

84
views
timecomplexity
recursion
algorithms
0
votes
0
answers
21
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(n1,k1) + c(n,k1)$ terminating condition $c(n,n) = 1, c(n,0) = 1$.
asked
Apr 28, 2018
in
Algorithms
by
hacker16
Active
(
2.7k
points)

126
views
algorithms
recursion
dynamicprogramming
0
votes
1
answer
22
SAnfoundary
What data structure would you most likely see in a nonrecursive implementation of a recursive algorithm? Linked List Stack Queue Tree please explain also
asked
Mar 23, 2018
in
Programming
by
Moin Mukhtar
(
245
points)

137
views
datastructure
recursion
0
votes
0
answers
23
Printing elements of linkedlist 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); } }
asked
Mar 6, 2018
in
Programming
by
Ahsanul Hoque
(
185
points)

113
views
recursion
linkedlists
+8
votes
6
answers
24
GATE201821
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 ______.
asked
Feb 14, 2018
in
Programming
by
gatecse
Boss
(
16.1k
points)

2.7k
views
gate2018
programminginc
numericalanswers
recursion
programming
0
votes
1
answer
25
recursion
did recursion is bottom up approach to problem solving?
asked
Feb 9, 2018
in
Programming
by
kd.....
Junior
(
799
points)

94
views
recursion
+3
votes
1
answer
26
MadeEasy Test Series 2018: Programming & DS  Recursion
asked
Jan 28, 2018
in
Algorithms
by
sumit chakraborty
Active
(
1.1k
points)

146
views
programming
recursion
madeeasytestseries
+4
votes
1
answer
27
MadeEasy Test Series 2018: Programming & DS  Recursion
asked
Jan 18, 2018
in
Programming
by
Abhishek Kumar Singh
Junior
(
813
points)

205
views
programming
recursion
madeeasytestseries
+4
votes
0
answers
28
Time Complexity
T(n) $\leq$ T($\frac{n}{5}$) + T($\frac{7n}{10}$) + 15n T(n) $\leq$ 5 when n $<$ 6
asked
Jan 9, 2018
in
Algorithms
by
Mk Utkarsh
Boss
(
34.8k
points)

118
views
timecomplexity
algorithms
asymptoticnotations
recursion
+4
votes
0
answers
29
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}}$
asked
Jan 8, 2018
in
Algorithms
by
Aakanchha
Junior
(
655
points)

166
views
algorithms
timecomplexity
recurrence
recursion
+7
votes
1
answer
30
T(n) = T(n/4) + T(3n/4) +n
How to solve above recurrence relation (With substitution method)??
asked
Jan 8, 2018
in
Algorithms
by
anoop yadav 2
(
87
points)

1.1k
views
algorithms
mastertheorem
recurrence
timecomplexity
recursion
Page:
1
2
3
4
next »
Quick search syntax
tags
tag:apple
author
user:martin
title
title:apple
content
content:apple
exclude
tag:apple
force match
+apple
views
views:100
score
score:10
answers
answers:2
is accepted
isaccepted:true
is closed
isclosed:true
Recent Posts
ISI MTECH CS 2019 INTERVIEW EXPERIENCE
IIT HYDERABAD MTECH TA INTERVIEW EXPERIENCE
How to prepare for GATE with a fulltime job??
Interview Experience at IISc
All subject Gate notes from Standard Books!!
Follow @csegate
Recent questions tagged recursion
Recent Blog Comments
Refund time depends on the payment mode ...
@Arjun Sir , when can i expect my refund in the...
This book is returned you can enable a pay now...
@Pranavcool The book stocks are over and no one...
@Lokesh Thats unfortunate. I have refunded you....
49,830
questions
54,802
answers
189,511
comments
80,747
users