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.
Recent questions and answers in Programming & DS
+16
votes
7
answers
1
GATE201716
Let $T$ be a binary search tree with 15 nodes. The minimum and maximum possible heights of $T$ are: Note: The height of a tree with a single node is $0$. $4$ and $15$ respectively. $3$ and $14$ respectively. $4$ and $14$ respectively. $3$ and $15$ respectively.
answered
2 hours
ago
in
DS
by
DEEPAK PANDEY 1
(
43
points)

2.3k
views
gate20171
datastructure
binarysearchtree
easy
+2
votes
3
answers
2
Complexity
int loop(int n) { for(int i=1;i<=n;i++) { for(int j=1;j<n;j+=i) { O(1) } } } What is the time complexity of above code segment?
answered
3 hours
ago
in
DS
by
SubVer
(
149
points)

280
views
timecomplexity
algorithms
0
votes
0
answers
3
#Data Structure
I was asked sometime ago in an interview draw generalised form of AVL tree that will contain all four rotations of AVL tree. I got confused I tried to explain them such notations one by one by drawing a tree on the board but they insisted me of some generalised form. Kindly help
asked
20 hours
ago
in
DS
by
Khursheed Bhat
(
33
points)

26
views
datastructure
avltree
0
votes
2
answers
4
trees
Given a preorder, postorder and inorder traversal of a tree, is it always possible to obtain a tree that satisfies each of the three conditions? Or is it possible to not obtain a tree at all?
answered
21 hours
ago
in
DS
by
himgta
(
193
points)

20
views
binarytree
algorithms
spanningtree
binarysearchtree
+5
votes
2
answers
5
Max Heap Counting
MY SOLUTION : Fix the root then next level 2 elements ( 2! possibilities) next level 4 elements( 4! possibilities) last level 2 elements ( 2! possibilities) total possibility = 2! * 4! * 2! = 2 * 24 * 2 = 96 what went wrong ? ... 9 such that if node of above graph is filled with these elements it satisfies max heap property a)96 b)896 c)2688 d) none
answered
1 day
ago
in
DS
by
smsubham
Boss
(
5.5k
points)

211
views
madeeasytestseries
max
binaryheap
+2
votes
1
answer
6
Datastructres
The number of distinct max heap are possible with keys 1, 2, 3, 4, 5 are ________.
answered
1 day
ago
in
DS
by
smsubham
Boss
(
5.5k
points)

62
views
binaryheap
heap
algorithms
datastructure
+2
votes
3
answers
7
the gate book
The no. of binary trees with 3 nodes which when traversed by postorder gives the sequence A, B, C is: (a) 3 (b) 9 (c) 7 (d) 5
answered
2 days
ago
in
DS
by
SameekshaGupta
(
99
points)

113
views
binarytree
+1
vote
1
answer
8
binary treee
The minimum size that an array may require to store a binary tree with 'n' nodes is ______. if queston is about min size of an array ..then we go with compete binary tree or not.
answered
2 days
ago
in
Programming
by
smsubham
Boss
(
5.5k
points)

35
views
binarytree
0
votes
2
answers
9
C practice Qustion
Why not Output is showing 90? #include <stdio.h> int main() { extern int p; printf("%d ", p); { int p = 90; printf("%d ", p); } }
answered
3 days
ago
in
Programming
by
SameekshaGupta
(
99
points)

56
views
programminginc
+1
vote
3
answers
10
C programming
int fun (x : integer) { if(x>100)then return (x10); else return(fun(fun(x+11))) } What would the following function return for input x = 95
[closed]
answered
3 days
ago
in
Programming
by
Ashwani
(
15
points)

55
views
programminginc
output
programming
functions
+4
votes
4
answers
11
GATE201845
Consider the following program written in pseudocode. Assume that $x$ and $y$ are integers. Count (x, y) { if (y !=1 ) { if (x !=1) { print("*"); Count (x/2, y); } else { y=y1; Count (1024, y); } } } The number of times that the $print$ statement is executed by the call $Count(1024, 1024)$ is _____
answered
3 days
ago
in
Programming
by
Saurabh Agrawal
(
19
points)

1.3k
views
gate2018
programminginc
numericalanswers
+6
votes
5
answers
12
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 ______.
answered
4 days
ago
in
Programming
by
G Shaheena
Junior
(
771
points)

1k
views
gate2018
programminginc
numericalanswers
recursion
+5
votes
2
answers
13
GATE20182
Consider the following C program: #include<stdio.h> struct Ournode{ char x, y, z; }; int main() { struct Ournode p={'1', '0', 'a'+2}; struct Ournode *q=&p; printf("%c, %c", *((char*)q+1), *((char*)q+2)); return 0; } The output of this program is: 0, c 0, a+2 '0', 'a+2' '0', 'c'
answered
5 days
ago
in
Programming
by
smsubham
Boss
(
5.5k
points)

1.2k
views
gate2018
programminginc
programming
structures
pointers
normal
+3
votes
2
answers
14
GATE20183
A queue is implemented using a noncircular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let $n$ denote the number of nodes in the queue. Let 'enqueue' be implemented by inserting a new node at the head, and 'dequeue' be ... (1), \theta(1)$ $\theta(1), \theta(n)$ $\theta(n), \theta(1)$ $\theta(n), \theta(n)$
answered
5 days
ago
in
DS
by
smsubham
Boss
(
5.5k
points)

1.2k
views
gate2018
algorithms
datastructure
queues
normal
linkedlists
+2
votes
4
answers
15
GATE201820
The postorder traversal of a binary tree is 8, 9, 6, 7, 4, 5, 2, 3, 1. The inorder traversal of the same tree is 8, 6, 9, 4, 7, 2, 5, 1, 3. The height of a tree is the length of the longest path from the root to any leaf. The height of the binary tree above is _____
answered
5 days
ago
in
DS
by
Digvijay Pandey
Veteran
(
53.5k
points)

909
views
gate2018
datastructure
binarytree
numericalanswers
+4
votes
1
answer
16
GATE201832
Consider the following C code. Assume that unsigned long int type length is 64 bits. unsigned long int fun(unsigned long int n) { unsigned long int i, j, sum = 0; for( i=n; i>1; i=i/2) j++; for( ; j>1; j=j/2) sum++; return sum; } The value returned when we call fum with the input $2^{40}$ is 4 5 6 40
answered
5 days
ago
in
Programming
by
Digvijay Pandey
Veteran
(
53.5k
points)

1k
views
gate2018
programminginc
normal
+4
votes
3
answers
17
GATE201829
#include<stdio.h> void fun1(char* s1, char* s2){ char* temp; temp = s1; s1 = s2; s2 = temp; } void fun2(char** s1, char** s2){ char* temp; temp = *s1; *s1 = *s2; *s2 = temp; } int main(){ char *str1="Hi", *str2 = ... %s", str1, str2); return 0; } The output of the program above is Hi Bye Bye Hi Hi Bye Hi Bye Bye Hi Hi Bye Bye Hi Bye Hi
answered
5 days
ago
in
Programming
by
Digvijay Pandey
Veteran
(
53.5k
points)

1.4k
views
gate2018
programminginc
pointers
parameterpassing
normal
0
votes
0
answers
18
#Gate2018
Answer and explanation?
[closed]
asked
6 days
ago
in
DS
by
dark.hacker.beyhadh
(
165
points)

63
views
crossedge
+2
votes
1
answer
19
RBR test series pointers
confusion in the print statement ,
answered
6 days
ago
in
Programming
by
shashanksingh
(
115
points)

73
views
programminginc
pointers
+2
votes
4
answers
20
The gate book
Which of the following need not be a binary tree? (a) Heap (b) BTree (c) AVL Tree (d) None of these
answered
6 days
ago
in
DS
by
smsubham
Boss
(
5.5k
points)

659
views
trees
+2
votes
1
answer
21
Programming in C
How many asterisks (*) in terms of k will be printed by the following C function, when called as count(m) where m = 3k? Justify your answer. Assume that 4 bytes are used to store an integer in C and k is such that 3k can be stored in 4 bytes. void count(int n) { printf("*"); if(n>1) { count(n/3); count(n/3); count(n/3); } }
answered
6 days
ago
in
Programming
by
Mamta Satywali
Junior
(
613
points)

38
views
programminginc
isipcb2015sample
+1
vote
2
answers
22
Practice Question
#include<stdio.h> int main(void) { int p = 1; int q = 0; q = p++ + p++; printf("%d %d",p,q); return 0; } Output is Showing 3,3 How ?
answered
Feb 13
in
Programming
by
Nayab786
(
21
points)

55
views
programminginc
programminginc
0
votes
1
answer
23
techtud programming
Answer is C . But i want to know what is segmentation fault?
answered
Feb 12
in
Programming
by
Lakshay Kakkar
Junior
(
543
points)

46
views
programminginc
output
0
votes
2
answers
24
ACE test
What is the time complexity to insert a new Node in a singly circular linked list at Starting ? (Number of nodes in list = N) A. O(1) B. O(N)
answered
Feb 12
in
Programming
by
smsubham
Boss
(
5.5k
points)

139
views
acetestseries
linkedlists
0
votes
3
answers
25
singly linked list
Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head and tail pointer. Given the representation, which of the following operation can be implemented in O(1) time? i) Insertion at the front of ... list iii) Deletion of the front node of the linked list iv) Deletion of the last node of the linked list
answered
Feb 12
in
DS
by
flash12
Junior
(
701
points)

987
views
+1
vote
1
answer
26
rbr test series
answered
Feb 12
in
Programming
by
Lakshman Patel RJIT
Boss
(
5.6k
points)

44
views
programminginc
0
votes
0
answers
27
Data Structure Trees Gate 2016
The number of ways in which numbers 1,2,3,4,5,6,7 can be inserted in an empty binary tree such that the resulting tree has height 6 is ......
[closed]
asked
Feb 12
in
Programming
by
Sukhman
(
27
points)

31
views
0
votes
1
answer
28
ISRODEC201747
Which of the following permutation can be obtained in the same order using a stack assuming that input is the sequence $5,6,7,8,9$ in that order? $7,8,9,5,6$ $5,9,6,7,8$ $7,8,9,6,5$ $9,8,7,5,6$
answered
Feb 11
in
DS
by
habedo007
Active
(
1.4k
points)

69
views
isrodec2017
0
votes
1
answer
29
recursion
did recursion is bottom up approach to problem solving?
answered
Feb 10
in
Programming
by
dark.hacker.beyhadh
(
165
points)

36
views
recursion
0
votes
1
answer
30
linked list
the sorage requirements of a linked stack with n elements will be what
answered
Feb 10
in
DS
by
dark.hacker.beyhadh
(
165
points)

53
views
linkedlists
datastructure
algorithms
programminginc
+2
votes
1
answer
31
#include<stdio.h> int main() { int x=191; char *p; p=(char*)&x; printf("%d",*p); } explain it
answered
Feb 9
in
Programming
by
utkrisht patesaria
(
13
points)

88
views
programminginc
programming
nongate
+1
vote
2
answers
32
UGCNETJune2010II21
If we have six stack operationspushing and popping each of $A, B$ and $C$such that push $(A)$ must occur before push $(B)$ which must occur before push $(C)$, then $A, C, B$ is a possible order for the pop ... could not be the order the pop operations are run, if we are to satisfy the requirements described above? $ABC$ $CBA$ $BAC$ $CAB$
answered
Feb 9
in
DS
by
smsubham
Boss
(
5.5k
points)

242
views
ugcnetjune2010ii
datastructure
stack
0
votes
2
answers
33
Program Output
What will be the output: #include <iostream> using namespace std; int main() { char *A[] = { "abcx", "dbba", "cccc"}; char var = *(A+1)  *A+1; cout << (*A + var); } 1. abba 2. bba 3. a d. none
answered
Feb 8
in
Programming
by
ChiragJoshi
(
101
points)

68
views
+1
vote
1
answer
34
UGCNet 2017
answered
Feb 8
in
Programming
by
iarnav
Veteran
(
20k
points)

36
views
ugcnetnov2017ii
+2
votes
2
answers
35
All pair shortest path
Algorithm which solves the all pair shortest path problem is A)Dijkstra's algorithm B)Floyd's algorith C)Prim's algorithmm D)Warshall's algorithm
answered
Feb 6
in
DS
by
Nagamani
(
113
points)

1.6k
views
graphalgorithms
graphtheory
0
votes
2
answers
36
Self doubt
#include <stdio.h> #define MAN(x,y) ((x)>(y))?(x):(y); int main() { int i=10,j=5,k=0; k=MAN(++i,j++); printf("%d %d %d",i,j,k); return 0; } I expected out is 11 6 11. But I am wrong. Answer: 12 6 12 . Why this happen.Can anyone explain this?
asked
Feb 5
in
Programming
by
Raj Kumar 7
(
329
points)

72
views
0
votes
1
answer
37
CMI2017A07
Consider the following functions f() and g(). f(){ g(){ w=5; z=w+1; w=2*z+2; z=3*zw; } print(z); } We start with w and z set to 0 and execute f() and g() in parallelâ€”that is, at each step we either execute one statement from f() or one statement from g(). Which of the following is not a possible value printed by g()? (a) 2 (b) 1 (c) 2 (d) 4
asked
Feb 5
in
Programming
by
Tesla!
Veteran
(
14.2k
points)

52
views
cmi2017
output
programming
0
votes
1
answer
38
CMI2017A06
What does the following function compute in terms of n and d, for integer values of d? Note that the operation / denotes floating point division, even if the arguments are both integers. function foo(n,d){ if (d == 0){ return 1; }else{ if (d < 0){ return foo(n,d ... $n^{d}$ for all values of d (c) n*d if d>0, n/d if d<0 (d) n*d for all values of d
asked
Feb 5
in
Programming
by
Tesla!
Veteran
(
14.2k
points)

71
views
programminginc
programming
cmi2017
+1
vote
1
answer
39
gate 2018
there was a question on global counter variable what is the answer to that question???
asked
Feb 5
in
Programming
by
akshayakrant
(
101
points)

371
views
0
votes
3
answers
40
gate cs 2018
for what value of x it will have maximum number of minimum spanning trees ? what is the number of minimum spanning trees
asked
Feb 4
in
DS
by
akshayakrant
(
101
points)

654
views
To see more, click for all the
questions in this category
.
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
Members at the site
Mangesh Mate
Sachin Mittal 1
Rajat Bhatia
imamitk9
dipta.ddc
Yash Khanna
Amit Navik
akash.dinkar12
srestha
GAURAV_JAIN
shivanisrivarshini
Salazar
Neelay Upadhyaya
sakht launda
MIRIYALA JEEVAN KUMA
Anup patel
sumit goyal 1
ankur.srivastava
Recent Posts
NIELIT(17 Dec 2017) Result Out
Contest/challenge GATE201825
IISC admission
Admission in IITS through COAPS
IITKanpur
All categories
General Aptitude
1.2k
Engineering Mathematics
4.7k
Digital Logic
1.9k
Programming & DS
3.5k
Programming
2.5k
DS
947
Algorithms
3k
Theory of Computation
3.7k
Compiler Design
1.5k
Operating System
2.7k
Databases
2.8k
CO & Architecture
2.5k
Computer Networks
2.9k
Non GATE
835
Others
1.2k
Admissions
271
Exam Queries
393
Tier 1 Placement Questions
17
Job Queries
50
Projects
6
Follow @csegate
Gatecse
Recent questions and answers in Programming & DS
Recent Blog Comments
iam getting 65 in sta ,my serial number is ...
Yes..this is the list of candidates who secured ...
But this is not Final list.
Yes, Generally Data Science should be preferred. ...
Those who answered 35 must challenge  and even 1 ...
33,620
questions
40,170
answers
114,128
comments
38,555
users