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 DS
+2
votes
2
answers
1
GATE19887iii
Consider the tree given in the below figure, insert 13 and show the new balance factors that would arise if the tree is not rebalanced. Finally, carry out the required rebalancing of the tree and show the new tree with the balance factors on each mode.
answered
2 days
ago
in
DS
by
Prateek K
Active
(
1.2k
points)

110
views
gate1988
normal
descriptive
datastructure
+12
votes
2
answers
2
GATE19872c
State whether the following statements are TRUE or FALSE: It is possible to construct a binary tree uniquely whose preorder and postorder traversals are given?
answered
2 days
ago
in
DS
by
lambda
Junior
(
563
points)

387
views
gate1987
binarytree
datastructure
normal
+5
votes
1
answer
3
Binary search tree
answered
2 days
ago
in
DS
by
Abhishek Malik
(
183
points)

90
views
+21
votes
9
answers
4
GATE201010
In a binary tree with $n$ nodes, every node has an odd number of descendants. Every node is considered to be its own descendant. What is the number of nodes in the tree that have exactly one child? $0$ $1$ $\frac{(n1)}{2}$ $n1$
answered
3 days
ago
in
DS
by
Paras Nath
Loyal
(
8.5k
points)

2k
views
gate2010
datastructure
binarytree
normal
+7
votes
2
answers
5
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$
answered
3 days
ago
in
DS
by
Rohit Kumar 2
(
207
points)

3.8k
views
isro2013
arrays
+19
votes
2
answers
6
GATE1994_26
A queue $Q$ containing $n$ items and an empty stack $S$ are given. It is required to transfer all the items from the queue to the stack, so that the item at the front of queue is on the TOP of the stack, and the order of all other items are ... which can be performed on the queue and stack are Delete, Insert, Push and Pop. Do not assume any implementation of the queue or stack.
answered
4 days
ago
in
DS
by
Prateek K
Active
(
1.2k
points)

757
views
gate1994
datastructure
queues
stack
normal
+51
votes
8
answers
7
GATE 2016141
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$. ... Pop(S); Enqueue (Q, x); end end The maximum possible number of iterations of the while loop in the algorithm is _______.
answered
4 days
ago
in
DS
by
Prateek K
Active
(
1.2k
points)

5.2k
views
gate20161
datastructure
queues
difficult
numericalanswers
+29
votes
6
answers
8
GATE1994_1.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}$
answered
5 days
ago
in
DS
by
Prateek K
Active
(
1.2k
points)

3.3k
views
gate1994
datastructure
arrays
normal
+16
votes
2
answers
9
GATE20055
A program $P$ reads in $500$ integers in the range $[0, 100]$ representing the scores of $500$ students. It then prints the frequency of each score above $50$. What would be the best way for $P$ to store the frequencies? An array of $50$ numbers An array of $100$ numbers An array of $500$ numbers A dynamically allocated array of $550$ numbers
answered
5 days
ago
in
DS
by
Prateek K
Active
(
1.2k
points)

2k
views
gate2005
datastructure
arrays
easy
+7
votes
2
answers
10
GATE19876a
A list of $n$ elements is commonly written as a sequence of $n$ elements enclosed in a pair of square brackets. For example. $[10, 20, 30]$ is a list of three elements and $[]$ is a nil list. Five functions are defined below: $car (l)$ returns the first element of its argument list $l$; $cdr ( ... $ What do the following compute? (a) $f ([32, 16, 8], [9, 11, 12])$ (b) $g ([5, 1, 8, 9])$
answered
5 days
ago
in
DS
by
lambda
Junior
(
563
points)

366
views
gate1987
datastructure
linkedlists
0
votes
0
answers
11
#Testseries
The number of binary search tree’s with 4 nodes (1, 2, 3, 4) possible where in every binary search tree ‘1’ is leaf node are ..... How to solve such type of questions in the simple way?
asked
6 days
ago
in
DS
by
himgta
(
417
points)

39
views
+4
votes
1
answer
12
Binary Tree
What is the number of binary trees with 4 nodes which when traversed in preorder gives the sequence 1,2,3,4?
answered
6 days
ago
in
DS
by
Arjun Satpathy
(
23
points)

130
views
datastructure
binarytree
0
votes
1
answer
13
Data Structures
Arrange the following Datastructures in the nondecreasing order of worst case time complexities on the operation $Search$ Binary Search Trees, Linked List, Array, Hash Table
answered
Apr 10
in
DS
by
gari
Active
(
3.2k
points)

32
views
+11
votes
4
answers
14
min heap
The number of binary min. heaps that can be formed from a set of 7 distinct integers is _________?
answered
Apr 10
in
DS
by
Anirudh Pandey
Junior
(
991
points)

2.4k
views
algorithms
heap
permutationsandcombinations
+22
votes
3
answers
15
GATE2008IT72
A Binary Search Tree (BST) stores values in the range $37$ to $573$. Consider the following sequence of keys. $81, 537, 102, 439, 285, 376, 305$ $52, 97, 121, 195, 242, 381, 472$ $142, 248, 520, 386, 345, 270, 307$ $550, 149, 507, 395, 463, ... is an inorder sequence of some BST where $121$ is the root and $52$ is a leaf IV is a postorder sequence of some BST with $149$ as the root
answered
Apr 2
in
DS
by
Prateek Raghuvanshi
Junior
(
899
points)

946
views
gate2008it
datastructure
binarysearchtree
easy
+1
vote
1
answer
16
test series
Stack valid permutation , They haven't mentioned anywhere that input is in ascending order
answered
Mar 31
in
DS
by
abhishekmehta4u
Loyal
(
9k
points)

39
views
0
votes
1
answer
17
testseries
Data structure for loop. What is oxf ? can somebody explain
answered
Mar 30
in
DS
by
pankaj_vir
Loyal
(
6.2k
points)

36
views
+1
vote
1
answer
18
What is correct about statements S1 and S2?
answered
Mar 29
in
DS
by
pankaj_vir
Loyal
(
6.2k
points)

54
views
graphtheory
+29
votes
7
answers
19
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$
answered
Mar 24
in
DS
by
Ayan Mondol
(
27
points)

4k
views
gate2003
datastructure
stack
normal
+29
votes
2
answers
20
GATE20151_23
What are the worstcase complexities of insertion and deletion of a key in a binary search tree? $\Theta(\log n)$ for both insertion and deletion $\Theta(n)$ for both insertion and deletion $\Theta(n)$ for insertion and $\Theta(\log n)$ for deletion $\Theta(\log n)$ for insertion and $\Theta(n)$ for deletion
answered
Mar 24
in
DS
by
abhishekmehta4u
Loyal
(
9k
points)

1.4k
views
gate20151
datastructure
binarysearchtree
easy
+16
votes
3
answers
21
GATE20151_25
The height of a tree is the length of the longest roottoleaf path in it. The maximum and minimum number of nodes in a binary tree of height $5$ are $63$ and $6$, respectively $64$ and $5$, respectively $32$ and $6$, respectively $31$ and $5$, respectively
answered
Mar 24
in
DS
by
pankaj_vir
Loyal
(
6.2k
points)

1.6k
views
gate20151
datastructure
binarytree
easy
+20
votes
4
answers
22
GATE20153_19
Consider the following array of elements. $\langle 89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100 \rangle$ The minimum number of interchanges needed to convert it into a maxheap is $4$ $5$ $2$ $3$
answered
Mar 24
in
DS
by
pankaj_vir
Loyal
(
6.2k
points)

1.1k
views
gate20153
datastructure
heap
normal
+20
votes
4
answers
23
GATE1991_03,vii
Choose the correct alternatives (more than one may be correct) and write the corresponding letters only: The following sequence of operations is performed on a stack: PUSH (10), PUSH (20), POP, PUSH (10), PUSH (20), POP, POP, POP, PUSH (20), POP The sequence of values popped out is $20,10,20,10,20$ $20,20,10,10,20$ $10,20,20,10,20$ $20,20,10,20,10$
answered
Mar 23
in
DS
by
pankaj_vir
Loyal
(
6.2k
points)

652
views
gate1991
datastructure
stack
easy
+19
votes
8
answers
24
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
Mar 23
in
DS
by
pankaj_vir
Loyal
(
6.2k
points)

2.6k
views
gate20171
datastructure
binarysearchtree
easy
+6
votes
2
answers
25
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 implemented by deletion ... $\theta(1), \theta(1)$ $\theta(1), \theta(n)$ $\theta(n), \theta(1)$ $\theta(n), \theta(n)$
answered
Mar 22
in
DS
by
das_ts
(
39
points)

1.6k
views
gate2018
algorithms
datastructure
queues
normal
linkedlists
+3
votes
0
answers
26
Binary Search Tree
When searching for the key value 30 in a binary search tree, nodes containing the key values 10, 20, 25, 35, 70, 80, 90, 100 are traversed, not necessarily in the order given. How many different orders are possible in which these key values can occur on the search ...  what is difference between solution 1) and solution 2)? why in both case answer is different?
asked
Mar 22
in
DS
by
srestha
Veteran
(
81.6k
points)

70
views
datastructure
bst
0
votes
0
answers
27
BFSBreadth first search
State True or False with explanation The depth of a breadthfirst search tree on an undirected graph $G = (V, E)$ from an arbitrary vertex $v \in V$ is the diameter of the graph $G$. (The diameter $d$ of a graph is the smallest $d$ such that every pair of vertices $s$ and $t$ have $\delta(s, t) \leq d$)
asked
Mar 21
in
DS
by
akshat sharma
Active
(
1.5k
points)

57
views
bfs
datastructure
0
votes
2
answers
28
Test Series
Delete the key sequence [6,5,4] from the below AVL tree. How many rotations are needed to make it balanced AVL tree again?
answered
Mar 21
in
DS
by
abhishekmehta4u
Loyal
(
9k
points)

64
views
data
datastructure
avltree
bst
0
votes
2
answers
29
Tree question
In delete operation of BST, we need inorder successor (or predecessor) of a node when the node to be deleted has both left and right child as nonempty. Which of the following is true about inorder successor needed in delete operation? Inorder Successor ... Inorder successor may be an ancestor of the node Inorder successor is always either a leaf node or a node with empty right child
answered
Mar 21
in
DS
by
abhishekmehta4u
Loyal
(
9k
points)

38
views
datastructure
tree
+3
votes
2
answers
30
ISRODEC201751
Suppose the numbers $7,5,1,8,3,6,0,9,4,2$ are inserted in that order into an initially empty binary search tree.The binary search tree uses the reversal ordering on natural numbers i.e. $9$ is assumed to be smallest and $0$ is assumed to be largest. The $in$$order$ traversal of the resultant binary search tree ... 7$ $0,1,2,3,4,5,6,7,8,9$ $0,2,4,3,1,6,5,9,8,7$ $9,8,7,6,5,4,3,2,1,0$
answered
Mar 20
in
DS
by
Swati Rauniyar
Active
(
1.5k
points)

377
views
isrodec2017
binarysearchtree
+21
votes
8
answers
31
GATE2014342
Consider the C function given below. Assume that the array $listA$ contains $n (>0)$ elements, sorted in ascending order. int ProcessArray(int *listA, int x, int n) { int i, j, k; i = 0; j = n1; do { k = (i+j)/2; if (x ... $listA$. It is an implementation of binary search. It will always find the maximum element in $listA$. It will return −$1$ even when $x$ is present in $listA$.
answered
Mar 14
in
DS
by
Acharya Swaroop
(
11
points)

2k
views
gate20143
datastructure
arrays
easy
+1
vote
0
answers
32
GATE1997_16
In this GATE ques Part a) For Size balanced tree the recurrence (max height) is T(h)=T(h1) +T(h2) +1, solving which we get T(0)=1, T(1)=2,T(2)=1+2+1=4, T(3)=4+2+1=7 Here, T(0),T(1),T(2) are of the form 2h but T(3) is not equal to 23 then how can we claim that "sizebalance binary tree of height 'h' contain at least 2h nodes." ?
[closed]
asked
Mar 14
in
DS
by
Mamta Satywali
Active
(
2.2k
points)

99
views
gate1997
datastructure
binarytree
0
votes
2
answers
33
testseries
Time complexity circular LL i think aswer is A . this Q is similar to https://gateoverflow.in/61880/complexity but here they haven't mentioned about any pointer. here is my explanation
answered
Mar 12
in
DS
by
Ananya Jaiswal 1
Active
(
1.2k
points)

46
views
+1
vote
2
answers
34
ISRODEC201756
Which one of the following property is correct for a redblack tree? Every simple path from anode to a descendant leaf contains the same number of black nodes. If a node is red, then one children is red and another is black. If a node is red, then both its children are red. Every leaf node (sentinel node) is red.
answered
Mar 11
in
DS
by
pankaj_vir
Loyal
(
6.2k
points)

413
views
isrodec2017
+1
vote
2
answers
35
test_series
Data structure BST I thinks answer is 2 either ascending or descending
answered
Mar 11
in
DS
by
Ananya Jaiswal 1
Active
(
1.2k
points)

36
views
+1
vote
1
answer
36
AVL tree
Consider the following elements inserted into an empty AVL tree in the following order 25, 10, 15, 17, 30, 35, 40, 21, 28 If [L(d)] be the sum of elements on left side of root and (Rd) be the sum of elements on right side of root, then the value of [(Rd) – (Ld) + Root] is ________.
answered
Mar 11
in
DS
by
abhishekmehta4u
Loyal
(
9k
points)

55
views
avltree
datastructure
tree
+1
vote
2
answers
37
wooe test
In what order we should insert the following elements into an empty AVL tree so that we don’t have to perform any rotation on it. 1, 2, 3, 4, 5, 6, 7 A. 4, 2, 1, 6, 3, 5, 7 B. 4, 2, 6, 1, 3, 5, 7 C. 6, 4, 5, 7, 1, 2, 3 D. 4, 5, 3, 2, 1, 6, 7
[closed]
answered
Mar 11
in
DS
by
abhishekmehta4u
Loyal
(
9k
points)

62
views
avltree
0
votes
1
answer
38
test series
When searching for the key value 50 in a binary search tree, the node containing the key values 10, 30, 40, 70, 90, 120, 150, 175 are traversed, in any order. The number of different orders passing in which these keys values can occur on the search path from the root to the node containing the value 50 is ________.
[closed]
answered
Mar 10
in
DS
by
Ananya Jaiswal 1
Active
(
1.2k
points)

55
views
+14
votes
3
answers
39
TIFR2011B30
Consider an array $A[1...n]$. It consists of a permutation of numbers $1....n$. Now compute another array $B[1...n]$ as follows: $B[A[i]]:= i$ for all $i$. Which of the following is true? $B$ will be a sorted array. $B$ is a permutation of array $A$. Doing the same transformation twice will not give the same array. $B$ is not a permutation of array $A$. None of the above.
answered
Mar 9
in
DS
by
Karthik Dheeraj 1
(
21
points)

556
views
tifr2011
datastructure
arrays
+2
votes
2
answers
40
ISRODEC201749
A binary search tree is used to locate the number $43.$ Which one of the following probe sequence is not possible? $61,52,14,17,40,43$ $10,65,31,48,37,43$ $81,61,52,14,41,43$ $17,77,27,66,18,43$
answered
Mar 9
in
DS
by
Keval Kubavat
(
475
points)

390
views
isrodec2017
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
Shubham Kumar 7
Arjun
Ananya Jaiswal 1
rahul sharma 5
Kapil
Ayush Varshney
stanchion
DeepakKumar
Sachin Mittal 1
Subarna Das
Recent Posts
Placement Statistics for Computer Science
IIT Bombay Admission
ISRO 2018
NTRO Final year Eligibility
Fake Accounts
All categories
General Aptitude
1.2k
Engineering Mathematics
4.9k
Digital Logic
2k
Programming & DS
3.6k
Programming
2.6k
DS
964
Algorithms
3k
Theory of Computation
3.9k
Compiler Design
1.5k
Operating System
2.8k
Databases
2.9k
CO & Architecture
2.5k
Computer Networks
2.9k
Non GATE
949
Others
1.3k
Admissions
408
Exam Queries
419
Tier 1 Placement Questions
17
Job Queries
54
Projects
9
Follow @csegate
Gatecse
Recent questions and answers in DS
Recent Blog Comments
No. There was no penalty. We were allowed to ...
You have to write the entire code. I attempted 5 ...
Let's say c = 5 and p = ...
In this problem we need to choose p integers from ...
The fact is to improve the maximum ...
34,770
questions
41,729
answers
118,874
comments
41,381
users