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
Hot questions in Programming & DS
Recent
Hot!
Most votes
Most answers
Most views
Featured
Previous GATE
Webpage
Programming in C.
Recursion.
Recent
Hot!
Most votes
Most answers
Most views
Featured
Previous GATE
+63
votes
12
answers
1
GATE2016240
The number of ways in which the numbers $1, 2, 3, 4, 5, 6, 7$ can be inserted in an empty binary search tree, such that the resulting tree has height $6$, is _________. Note: The height of a tree with a single node is $0$.
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
42.5k
points)

7.6k
views
gate20162
datastructure
binarysearchtree
normal
numericalanswers
+3
votes
1
answer
2
what is the difference between type conversion and type casting in c ?
asked
May 10, 2016
in
Programming
by
Vivek Jain
Junior
(
809
points)

15.6k
views
+55
votes
9
answers
3
GATE2016141
Let $Q$ denote a queue containing sixteen numbers and $S$ be an empty stack. $Head(Q)$ returns the element at the head of the queue $Q$ without removing it from $Q$. Similarly $Top(S)$ returns the element at the top of $S$ without removing it from $S$. Consider ... Pop(S); Enqueue (Q, x); end end The maximum possible number of iterations of the while loop in the algorithm is _______.
asked
Feb 12, 2016
in
DS
by
Sandeep Singh
Loyal
(
7.8k
points)

5.8k
views
gate20161
datastructure
queues
difficult
numericalanswers
+23
votes
8
answers
4
GATE2017255
Consider the following C program. #include<stdio.h> #include<string.h> int main() { char* c=”GATECSIT2017”; char* p=c; printf(“%d”, (int)strlen(c+2[p]6[p]1)); return 0; } The output of the program is _______
asked
Feb 14, 2017
in
Programming
by
Madhav
Active
(
2k
points)

5.3k
views
gate20172
programminginc
numericalanswers
+43
votes
5
answers
5
GATE200846
You are given the postorder traversal, $P$, of a binary search tree on the $n$ elements $1, 2, \dots, n$. You have to determine the unique binary search tree that has $P$ as its postorder traversal. What is the time complexity of the most efficient algorithm for doing this? $\Theta(\log n)$ $\Theta(n)$ $\Theta(n\log n)$ None of the above, as the tree cannot be uniquely determined
asked
Sep 12, 2014
in
DS
by
Kathleen
Veteran
(
59.5k
points)

7k
views
gate2008
datastructure
binarysearchtree
normal
+40
votes
7
answers
6
GATE2017108
Consider the C code fragment given below. typedef struct node { int data; node* next; } node; void join(node* m, node* n) { node* p = n; while(p>next != NULL) { p = p>next; } p>next = m; } Assuming that m and n point to valid NULL ... or append list m to the end of list n. cause a null pointer dereference for all inputs. append list n to the end of list m for all inputs.
asked
Feb 14, 2017
in
DS
by
khushtak
Loyal
(
7.6k
points)

5.4k
views
gate20171
datastructure
linkedlists
normal
+13
votes
3
answers
7
Find address of element in 3d array
A is an array $[2.....6, 2.....8, 2.......10]$ of elements. The starting location is $500$. The location of an element $A(5, 5, 5)$ using column major order is __________.
asked
Dec 4, 2015
in
DS
by
shikharV
Active
(
4.1k
points)

7.6k
views
datastructure
arrays
algorithms
+36
votes
6
answers
8
GATE2016215
$N$ items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decreasekey operation, a pointer is provided to the record on which the operation is to be performed. An algorithm performs the following operations on the ... operations put together? $O(\log^{2} N)$ $O(N)$ $O(N^{2})$ $\Theta\left(N^{2}\log N\right)$
asked
Feb 12, 2016
in
DS
by
Akash Kanase
Boss
(
42.5k
points)

6.1k
views
gate20162
datastructure
linkedlists
timecomplexity
normal
+15
votes
7
answers
9
GATE2017213
A circular queue has been implemented using a singly linked list where each node consists of a value and a single pointer pointing to the next node. We maintain exactly two external pointers FRONT and REAR pointing to the front node and the rear node of the queue, respectively. Which of ... node points to the front node. (I) only. (II) only. Both (I) and (II). Neither (I) nor (II).
asked
Feb 14, 2017
in
DS
by
Madhav
Active
(
2k
points)

5.7k
views
gate20172
datastructure
queues
+26
votes
5
answers
10
GATE200323
In a minheap with $n$ elements with the smallest element at the root, the $7^{th}$ smallest element can be found in time $\Theta (n \log n)$ $\Theta (n)$ $\Theta(\log n)$ $\Theta(1)$
asked
Sep 19, 2014
in
DS
by
Disha
(
121
points)

5.5k
views
gate2003
datastructure
heap
+17
votes
2
answers
11
GATE200937,ISRODEC201755
What is the maximum height of any AVLtree with $7$ nodes? Assume that the height of a tree with a single node is $0$. $2$ $3$ $4$ $5$
asked
Sep 22, 2014
in
DS
by
Kathleen
Veteran
(
59.5k
points)

6.1k
views
gate2009
datastructure
binarysearchtree
normal
isrodec2017
+21
votes
5
answers
12
GATE2017113
Consider the following C code: #include<stdio.h> int *assignval (int *x, int val) { *x = val; return x; } void main () { int *x = malloc(sizeof(int)); if (NULL == x) return; x = assignval (x,0); if (x) { x = ... made as $x == NULL$ and not as shown. compiles successfully but execution may result in dangling pointer. compiles successfully but execution may result in memory leak.
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
352k
points)

4.2k
views
gate20171
programminginc
programming
+45
votes
8
answers
13
GATE2014339
Suppose we have a balanced binary search tree $T$ holding $n$ numbers. We are given two numbers $L$ and $H$ and wish to sum up all the numbers in $T$ that lie between $L$ and $H$. Suppose there are $m$ such numbers in $T$. If the tightest upper bound on the time to compute the sum is $O(n^a\log^bn+m^c\log^dn)$, the value of $a+10b+100c+1000d$ is ______.
asked
Sep 28, 2014
in
DS
by
jothee
Veteran
(
98.7k
points)

5.8k
views
gate20143
datastructure
binarysearchtree
numericalanswers
normal
+25
votes
6
answers
14
GATE2016138
Consider the weighted undirected graph with $4$ vertices, where the weight of edge $\{i,j\}$ is given by the entry $W_{ij}$ in the matrix $W$. W=$\begin{bmatrix} 0&2 &8 &5 \\ 2&0 &5 &8 \\ 8&5 &0 ... possible integer value of $x$, for which at least one shortest path between some pair of vertices will contain the edge with weight $x$ is ___________.
asked
Feb 12, 2016
in
DS
by
Sandeep Singh
Loyal
(
7.8k
points)

5.4k
views
gate20161
datastructure
graphs
normal
numericalanswers
+40
votes
5
answers
15
GATE2017153
Consider the following C program. #include<stdio.h> #include<string.h> void printlength(char *s, char *t) { unsigned int c=0; int len = ((strlen(s)  strlen(t)) > c) ? strlen(s) : strlen(t); printf("%d\n", len); } ... $strlen$ is defined in $string.h$ as returning a value of type $size\_t$, which is an unsigned int. The output of the program is __________ .
asked
Feb 14, 2017
in
Programming
by
srestha
Veteran
(
88.7k
points)

5.3k
views
gate20171
programming
programminginc
normal
numericalanswers
+17
votes
5
answers
16
GATE2017237
Consider the C program fragment below which is meant to divide $x$ by $y$ using repeated subtractions. The variables $x$, $y$, $q$ and $r$ are all unsigned int. while (r >= y) { r=ry; q=q+1; } Which of the following conditions on the variables $x, y, q$ and $r$ before the execution of the ... \ \&\& \ (r==x) \ \&\& \ (y >0)$ $(q==0) \ \&\& \ (y>0)$
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
352k
points)

2.2k
views
gate20172
programming
loopinvariants
+18
votes
8
answers
17
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.
asked
Feb 14, 2017
in
DS
by
Arjun
Veteran
(
352k
points)

2.9k
views
gate20171
datastructure
binarysearchtree
easy
+35
votes
4
answers
18
GATE201344
Consider the following operation along with Enqueue and Dequeue operations on queues, where $k$ is a global parameter. MultiDequeue(Q){ m = k while (Q is not empty) and (m > 0) { Dequeue(Q) m = m – 1 } } What is the worst case time complexity of a sequence of $n$ queue operations on an initially empty queue? $Θ(n)$ $Θ(n + k)$ $Θ(nk)$ $Θ(n^2)$
asked
Aug 7, 2014
in
DS
by
gatecse
Boss
(
18k
points)

5.5k
views
gate2013
datastructure
algorithms
normal
queues
+20
votes
9
answers
19
GATE2017135
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); fun1(++n); printf("%d", n); } The output printed when $\text{fun1}(5)$ is called is $53423122233445$ $53423120112233$ $53423122132435$ $53423120213243$
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
352k
points)

3.3k
views
gate20171
programming
normal
tricky
recursion
+3
votes
4
answers
20
ISRO201753
In a doubly linked list the number of pointers affected for an insertion operation will be 4 0 1 Depends on the nodes of doubly linked list
asked
May 7, 2017
in
DS
by
sh!va
Boss
(
34.3k
points)

5k
views
isro2017
datastructure
linkedlists
badquestion
+21
votes
4
answers
21
GATE2016237
Consider the following program: int f (int * p, int n) { if (n <= 1) return 0; else return max (f (p+1, n1), p[0]  p[1]); } int main () { int a[] = {3, 5, 2, 6, 4}; print f(" %d", f(a, 5)); } Note: $max (x, y)$ returns the maximum of $x$ and $y$. The value printed by this program is ________.
asked
Feb 12, 2016
in
Programming
by
Akash Kanase
Boss
(
42.5k
points)

2.8k
views
gate20162
programminginc
normal
numericalanswers
+39
votes
6
answers
22
GATE200485
A program takes as input a balanced binary search tree with $n$ leaf nodes and computes the value of a function $g(x)$ for each node $x$. If the cost of computing $g(x)$ is: $$\Large \min \left ( \substack{\text{number of leafnodes}\\\text{in leftsubtree of $x$}}\;,\; \ ... case time complexity of the program is? $\Theta (n)$ $\Theta (n \log n)$ $\Theta(n^2)$ $\Theta (n^2\log n)$
asked
Sep 19, 2014
in
DS
by
Kathleen
Veteran
(
59.5k
points)

5.2k
views
gate2004
binarysearchtree
normal
datastructure
+7
votes
2
answers
23
ISRO20139
In an array of $2N$ elements that is both 2ordered and 3ordered, what is the maximum number of positions that an element can be from its position if the array were 1ordered? $1$ $2$ $N/2$ $2N  1$
asked
Apr 25, 2016
in
DS
by
makhdoom ghaya
Boss
(
40k
points)

4.1k
views
isro2013
arrays
+15
votes
5
answers
24
GATE2017236
The preorder traversal of a binary search tree is given by $12, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20$. Then the postorder traversal of this tree is $2, 6, 7, 8, 9, 10, 12, 15, 16, 17, 19, 20$ $2, 7, 6, 10, 9, 8, 15, 17, 20, 19, 16, 12$ $7, 2, 6, 8, 9, 10, 20, 17, 19, 15, 16, 12$ $7, 6, 2, 10, 9, 8, 15, 16, 17, 20, 19, 12$
asked
Feb 14, 2017
in
DS
by
Arjun
Veteran
(
352k
points)

2.2k
views
gate20172
datastructure
binarysearchtree
+28
votes
7
answers
25
GATE19941.11
In a compact single dimensional array representation for lower triangular matrices (i.e all the elements above the diagonal are zero) of size $n \times n$, nonzero elements, (i.e elements of lower triangle) of each row are stored one after another, starting from the first row, the index of the ... new representation is: $i+j$ $i+j1$ $(j1)+\frac{i(i1)}{2}$ $i+\frac{j(j1)}{2}$
asked
Oct 4, 2014
in
DS
by
Kathleen
Veteran
(
59.5k
points)

3.8k
views
gate1994
datastructure
arrays
normal
+11
votes
6
answers
26
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'
asked
Feb 14
in
Programming
by
gatecse
Boss
(
18k
points)

2k
views
gate2018
programminginc
programming
structures
pointers
normal
+48
votes
2
answers
27
GATE2015135
What is the output of the following C code? Assume that the address of $x$ is $2000$ (in decimal) and an integer requires four bytes of memory. int main () { unsigned int x [4] [3] = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}, {10, 11, 12}}; printf ("%u, %u, %u", x + 3, *(x + 3), *(x + 2) + 3); } $2036, 2036, 2036$ $2012, 4, 2204$ $2036, 10, 10$ $2012, 4, 6$
asked
Feb 13, 2015
in
Programming
by
makhdoom ghaya
Boss
(
40k
points)

4.9k
views
gate20151
programming
programminginc
normal
+30
votes
7
answers
28
GATE200364
Let S be a stack of size $n \geq1$. Starting with the empty stack, suppose we push the first n natural numbers in sequence, and then perform $n$ pop operations. Assume that Push and Pop operations take $X$ seconds each, and $Y$ seconds elapse between the end of one such stack ... $m$ from S. The average stacklife of an element of this stack is $n(X+Y)$ $3Y+2X$ $n(X+Y)X$ $Y+2X$
asked
Sep 17, 2014
in
DS
by
Kathleen
Veteran
(
59.5k
points)

4.4k
views
gate2003
datastructure
stack
normal
+20
votes
6
answers
29
GATE2017243
Consider the following snippet of a C program. Assume that swap $(\&x, \&y)$ exchanges the content of $x$ and $y$: int main () { int array[] = {3, 5, 1, 4, 6, 2}; int done =0; int i; while (done==0) { done =1; for (i=0; i<=4; i++) { if (array ... > array[i1]) { swap(&array[i], array[i1]); done =0; } } } printf( %d , array[3]); } The output of the program is _______
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
352k
points)

3.1k
views
gate20172
programming
algorithms
numericalanswers
identifyfunction
+12
votes
4
answers
30
min heap
The number of binary min. heaps that can be formed from a set of 7 distinct integers is _________?
asked
Jan 7, 2017
in
DS
by
Jithin Jayan
Active
(
1.8k
points)

2.8k
views
algorithms
heap
permutationsandcombinations
Page:
1
2
3
4
5
6
...
128
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
AAI Junior Exceutive(Information Technology)
The 2018 APL Problem Solving Contest
GO Classroom for GATE 2019
Mtech CSE  IITH (TA) Interview Experience
MS Programme @ IIT
All categories
General Aptitude
1.3k
Engineering Mathematics
5.3k
Digital Logic
2k
Programming & DS
3.8k
Programming
2.8k
DS
1k
Algorithms
3.3k
Theory of Computation
4.1k
Compiler Design
1.6k
Operating System
2.9k
Databases
3k
CO & Architecture
2.6k
Computer Networks
3k
Non GATE
1.1k
Others
1.4k
Admissions
494
Exam Queries
442
Tier 1 Placement Questions
19
Job Queries
59
Projects
9
Follow @csegate
Gatecse
Recent Blog Comments
@risabh sir ,does any such book available who ...
just read the post once you will get know to how ...
sir hw to buy these go 2019 hardcopy i need it ...
Hi Arjun, Below are my payment details, made on ...
Arjun sir i want to buy go 2019 hardbook hw to ...
37,019
questions
44,592
answers
126,850
comments
43,663
users