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

I forgot my password
All Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
Previous
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
2
answers
1
data structure
To remove recursion from a program we have to use which of the following data structure? array stack queue list
asked
6 days
ago
in
DS
by
eyeamgj
Active
(
2.4k
points)

53
views
datastructure
recursion
stack
0
votes
0
answers
2
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
in
Algorithms
by
kartikeya2812
(
7
points)

43
views
timecomplexity
algorithms
asymptoticnotations
recursion
+4
votes
3
answers
3
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
in
Algorithms
by
bts
(
107
points)

113
views
recursion
timecomplexity
algorithms
mastertheorem
0
votes
1
answer
4
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
in
Algorithms
by
hacker16
Active
(
2.7k
points)

67
views
timecomplexity
recursion
algorithms
0
votes
0
answers
5
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
in
Algorithms
by
hacker16
Active
(
2.7k
points)

42
views
algorithms
recursion
dynamicprogramming
0
votes
1
answer
6
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
in
Programming
by
Moin Mukhtar
(
253
points)

84
views
datastructure
recursion
0
votes
0
answers
7
Printing elements of linkedlist using recursion.
asked
Mar 6
in
Programming
by
Ahsanul Hoque
(
163
points)

82
views
recursion
linkedlists
+6
votes
6
answers
8
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
in
Programming
by
gatecse
Boss
(
18k
points)

1.5k
views
gate2018
programminginc
numericalanswers
recursion
0
votes
1
answer
9
recursion
did recursion is bottom up approach to problem solving?
asked
Feb 9
in
Programming
by
kd.....
(
239
points)

62
views
recursion
+3
votes
1
answer
10
ME test series
asked
Jan 28
in
Algorithms
by
sumit chakraborty
Active
(
1.2k
points)

89
views
madeeasytestseries
recurrence
recursion
+4
votes
1
answer
11
made easy test series
asked
Jan 18
in
Programming
by
Abhishek Kumar Singh
Junior
(
939
points)

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

86
views
timecomplexity
algorithms
asymptoticnotations
recursion
+4
votes
0
answers
13
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
in
Algorithms
by
Aakanchha
Junior
(
727
points)

109
views
algorithms
timecomplexity
recurrence
recursion
+6
votes
1
answer
14
T(n) = T(n/4) + T(3n/4) +n
How to solve above recurrence relation (With substitution method)??
asked
Jan 8
in
Algorithms
by
anoop yadav 2
(
103
points)

354
views
algorithms
mastertheorem
recurrence
timecomplexity
recursion
+4
votes
2
answers
15
t(n) = sqrt(2) t(n/2) + sqrt(n)
How to solve above recurrence relation?
asked
Jan 7
in
Algorithms
by
anoop yadav 2
(
103
points)

296
views
algorithms
recurrence
timecomplexity
recursion
+2
votes
0
answers
16
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
asked
Jan 5
in
DS
by
Ashwin Kulkarni
Boss
(
17.7k
points)

105
views
datastructure
stack
recursion
+2
votes
0
answers
17
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
asked
Dec 29, 2017
in
Compiler Design
by
srestha
Veteran
(
86.9k
points)

53
views
recursion
compilerdesign
+3
votes
1
answer
18
C Recursion
asked
Dec 24, 2017
in
Programming
by
Abhishek Kumar Singh
Junior
(
939
points)

110
views
recursion
programminginc
+3
votes
1
answer
19
Time Complexity
T(n) = T(n/2) + 2T(n/5) + T(n/10) + 4n What is the time complexity for the recursion above?
asked
Dec 5, 2017
in
Algorithms
by
Warlock lord
Active
(
3.4k
points)

189
views
timecomplexity
algorithms
asymptoticnotations
recursion
0
votes
0
answers
20
Time Complexity
hope(n){ if (n == 1) G(n) else F() + hope(n/2); } What is the time complexity for the given function, if the function G' and function F' take O(1) and O(n) unit of time respectively. My views: If we take the recursion in the form of "T(n) = T ... being called 'log n' times as well? Why can't the answer be O(nlogn) since F() (whose complexity is O(n)) is called 'log n' times?
asked
Dec 5, 2017
in
Algorithms
by
Warlock lord
Active
(
3.4k
points)

90
views
timecomplexity
algorithms
asymptoticnotations
recursion
0
votes
0
answers
21
[Algorithms] Tower of honoi
Can we solve Towers of honoi with DP? If yes,then what will be time and space complexity?
asked
Nov 26, 2017
in
Algorithms
by
rahul sharma 5
Boss
(
24.1k
points)

80
views
recursion
towersofhanoi
programming
timecomplexity
0
votes
1
answer
22
Recurssion problem.
What will be the output? for foo(4) 4332221234 4332221324 43222214 4332211223
asked
Nov 22, 2017
in
Programming
by
JPranavc
(
239
points)

73
views
recursion
0
votes
1
answer
23
programming
how static affects in this program?
asked
Nov 19, 2017
in
Programming
by
chandra sai
Active
(
1.2k
points)

57
views
recursion
+5
votes
2
answers
24
Time Complexity
Consider the following function Void 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?
asked
Nov 2, 2017
in
Algorithms
by
shaurya vardhan
Active
(
2.2k
points)

219
views
timecomplexity
algorithms
asymptoticnotations
recursion
programminginc
+3
votes
1
answer
25
Time Complexity
Consider the following code….. Search(int n){ if(n<2) then return; else{ s=0; for(i=1;i<=8;i++){ Search(n/2); } for(i=1;i<n*n;i++){ for(j=1;j<n;j=j*2){ s=s+i; } } } } Assume s is a global variable.Find the complexity of the given Search(n)?
asked
Nov 2, 2017
in
Algorithms
by
shaurya vardhan
Active
(
2.2k
points)

126
views
timecomplexity
algorithms
asymptoticnotations
recursion
programminginc
+3
votes
1
answer
26
Tower of Hanoi
In Tower of Hanoi problem, when we move 3 disk , it will rotate like Input : 3 Output : Disk 1 moved from A to C Disk 2 moved from A to B Disk 1 moved from C to B Disk 3 moved from A to C Disk 1 moved from B to A Disk 2 moved from ... www.cs.cmu.edu/~cburch/survey/recurse/hanoiex.html Some disk move I have shown here with recursion tree. Plz help me some moves of disk after this move
asked
Oct 27, 2017
in
DS
by
srestha
Veteran
(
86.9k
points)

130
views
recursion
algorithms
towersofhanoi
+2
votes
3
answers
27
c program
Consider the following code: int f(int num) { int result =0; if(num <= 1) return 1; else { for(i=num;i>=1;i) result+=f(i/3); } return result; } Anyone plz explain this code line by line for input num=6????
asked
Sep 28, 2017
in
Programming
by
Hira Thakur
Boss
(
12.5k
points)

247
views
programminginc
recursion
+2
votes
0
answers
28
time complexity
What is the time complexity of the following code snippet? Assume x is a global variable and “statement” takes O(n) time?
asked
Sep 11, 2017
in
Algorithms
by
Warlock lord
Active
(
3.4k
points)

171
views
timecomplexity
algorithms
asymptoticnotations
recursion
+2
votes
1
answer
29
#Backsubstitution
How to solve the following recurrence by back substitution. T(n)= √2 *T(n/2) + c , for n>1 = a for n=1
asked
Jul 21, 2017
in
Algorithms
by
Ashish Subscription
Junior
(
515
points)

271
views
algorithms
timecomplexity
recursion
recurrence
asymptoticnotations
#backsubstitution
+1
vote
1
answer
30
recursion
asked
Jul 14, 2017
in
Programming
by
gabbar
Junior
(
735
points)

213
views
recursion
programminginc
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
IISc CSA and CDCS written test and interview Experince
IIIT Hyderabad Interview Experience
My failure, Oh wait SUCCESS journey
ALGORITHMS CHECKLIST:
A Failure who got into IISc
Follow @csegate
Gatecse
Recent questions tagged recursion
Recent Blog Comments
Sir I didn't get an email for GO classroom, ...
any one with marks less than 125 selected?
Thank you @Arjun Sir, @NamitaAIR1, @Priyanka, ...
Your story is very inspiring for the boys like me ...
So you completed your Btech in 5 yrs? How could ...
36,194
questions
43,647
answers
124,088
comments
42,928
users