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

I forgot my password
Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
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 and answers in DS
0
votes
0
answers
1
Made Easy Test Series:DS
I want longest path from root to leaf. Then which code is correct among Code1 or Code2? Code1) int tree(Struct node *root){ int a=0, b=0,c=0; if(root==NULL) return 0; if((root>left==NULL)&&(root>right==NULL)) return 1; a=1+tree(root ... )&&(root>right==NULL)) return 1; a=tree(root>left); b=tree(root>right); c=1+max(a,b); return c; }
asked
1 day
ago
in
DS
by
srestha
Veteran
(
111k
points)

23
views
madeeasytestseries
datastructure
+17
votes
8
answers
2
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).
answered
1 day
ago
in
DS
by
ShamikBanerjee
Junior
(
669
points)

7.3k
views
gate20172
datastructure
queues
+17
votes
9
answers
3
GATE2015210
A binary tree T has $20$ leaves. The number of nodes in T having two children is ______.
answered
2 days
ago
in
DS
by
Rishi yadav
Boss
(
10.9k
points)

3.9k
views
gate20152
datastructure
binarytree
normal
numericalanswers
0
votes
0
answers
4
Assignment 2.9 (b) page no. 28 from book Classic Data Structures Second Edition by Debasis Samanta
asked
4 days
ago
in
DS
by
mahi.0409
(
7
points)

20
views
datastructure
debasissamanta
0
votes
0
answers
5
Data Structures in C by Sahni  Circular Queue using Dynamic Arrays
I'm learning data structures from a book. In the topic, Circular Queue using Dynamic Array, the author has mentioned below point, Let capacity be the initial capacity of the circular queue,We must first increase the size of ... capacity elements. But how does array doubling and slide to right copy at most 2 * capacity 2 elements??
asked
Apr 14
in
DS
by
Durga Teja
(
33
points)

31
views
datastructure
queues
0
votes
0
answers
6
# Binary tree
A weight balanced tree is a binary tree in which for each node, the no. of nodes in the left sub tree is atleast half and at most twice the no. of nodes in the right sub tree. The maximum possible height of such a tree with n nodes is best described by which of the following? (a) log2 n (b) log4/3 n (c) log3 n (d) log3/2 n
[closed]
asked
Apr 13
in
DS
by
Golam Murtuza
(
37
points)

23
views
0
votes
0
answers
7
AVL Tree Balancing
here what to do first as FIZZA and IMRAN both are unbalanced than either to do RR rotation from FIZZAIMRANNAVEEN or RL rotation from IMRANNAVEENLOVELY
asked
Apr 13
in
DS
by
kd.....
Junior
(
883
points)

23
views
avltree
datastructure
tree
bst
algorithms
0
votes
3
answers
8
GATE201940
Consider the following statements: The smallest element in a maxheap is always at a leaf node The second largest element in a maxheap is always a child of a root node A maxheap can be constructed from a binary search tree in $\theta(n)$ time A binary search tree can be ... time Which of te above statements are TRUE? I, II and III I, II and IV I, III and IV II, III and IV
answered
Apr 2
in
DS
by
Krishnahs
(
63
points)

2k
views
gate2019
datastructure
heap
+13
votes
3
answers
9
GATE199912
In binary tree, a full node is defined to be a node with $2$ children. Use induction on the height of the binary tree to prove that the number of full nodes plus one is equal to the number of leaves. Draw the minheap that results from insertion of the following elements in ... initially empty minheap: $7, 6, 5, 4, 3, 2, 1$. Show the result after the deletion of the root of this heap.
answered
Mar 24
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

973
views
gate1999
datastructure
heap
normal
+18
votes
3
answers
10
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$
answered
Mar 23
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

7k
views
gate2009
datastructure
binarysearchtree
normal
isrodec2017
+14
votes
3
answers
11
GATE200960
Consider a binary maxheap implemented using an array. What is the content of the array after two delete operations on $\left\{25,14,16,13,10,8,12\right\}$ $\left\{14,13,12,10, 8\right\}$ $\left\{14,12,13,8,10\right\}$ $\left\{14,13,8,12,10\right\}$ $\left\{14,13,12,8,10\right\}$
answered
Mar 23
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

1.2k
views
gate2009
datastructure
heap
normal
+14
votes
3
answers
12
GATE200959
Consider a binary maxheap implemented using an array. Which one of the following array represents a binary maxheap? $\left\{25,12,16,13,10,8,14\right\}$ $\left\{25,14,13,16,10,8,12\right\}$ $\left\{25,14,16,13,10,8,12\right\}$ $\left\{25,14,12,13,10,8,16\right\}$
answered
Mar 23
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

1.5k
views
gate2009
datastructure
heap
normal
+16
votes
2
answers
13
GATE200013
Suppose a stack implementation supports, in addition to PUSH and POP, an operation REVERSE, which reverses the order of the elements on the stack. To implement a queue using the above stack implementation, show how to implement ENQUEUE using a single operation and DEQUEUE using a sequence of $3$ ... $5 \ 2 * 3 \ 4 + 5 \ 2$ At the end of evaluation
answered
Mar 23
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

1.3k
views
gate2000
datastructure
stack
normal
descriptive
0
votes
0
answers
14
Made Easy:Programming &DS
The number of possible ordered trees with 3 nodes A,B,C is ??
asked
Mar 22
in
DS
by
sandeep singh gaur
(
255
points)

46
views
tree
+1
vote
1
answer
15
Self doubt
I have a confusion regarding the array implementation of binary tree ,i.e what are the index locations of the left child of a node whether it is 2i+1 or 2i and same for right child ,can anyone explain?
answered
Mar 17
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

51
views
datastructure
+2
votes
2
answers
16
Gateforum Test Series: Programming & DS  Binary Tree
Suppose binary tree has only three nodes A,B and C, and you are given the post order traversal of tree as BAC . The exact pre order traversal of the tree is? A)CAB B)ABC C)CBA D)Can't be determined from given information.
answered
Mar 14
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

90
views
gateforumtestseries
datastructure
binarytree
0
votes
1
answer
17
self doubt
if we know that the inorder of a balanced binary search tree is in ascending order, than can we say that the tym complexity to find this is O(1)??????
answered
Mar 11
in
DS
by
Àbhíjèét Míshrà
(
47
points)

56
views
0
votes
2
answers
18
UGCNETdec2009ii21
If the number of leaves in a strictly binary tree is an odd number, then what can you say with full conviction about total number of nodes in the tree ? (A) It is an odd number. (B) It is an even number. (C) It cannot be equal to the number of leaves. (D) It is always greater than twice the number of leaves.
answered
Mar 9
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

364
views
ugcnetdec2009ii
datastructure
binarytree
0
votes
1
answer
19
UPPCL AE 2018:69
answered
Mar 8
in
DS
by
Ram Swaroop
Active
(
2.6k
points)

31
views
uppcl2018
0
votes
1
answer
20
UPPCL AE 2018:73
answered
Mar 8
in
DS
by
Ram Swaroop
Active
(
2.6k
points)

37
views
uppcl2018
0
votes
1
answer
21
UPPCL AE 2018:15
answered
Mar 8
in
DS
by
Ram Swaroop
Active
(
2.6k
points)

22
views
uppcl2018
+16
votes
7
answers
22
TIFR2012B15
Let $T$ be a tree of $n$ nodes. Consider the following algorithm, that constructs a sequence of leaves $u_{1}, u_{2}...$. Let $u_{1}$ be some leaf of tree. Let $u_{2}$be a leaf that is farthest from $u_{1}$. Let $u_{3}$ be the leaf ... stays constant. For the same tree, the distance between the last two vertices visited can be different, based on the choice of the first leaf $u_{1}$.
answered
Mar 7
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

854
views
tifr2012
datastructure
trees
+43
votes
4
answers
23
GATE20036
Let $T(n)$ be the number of different binary search trees on $n$ distinct elements. Then $T(n) = \sum_{k=1}^{n} T(k1)T(x)$, where $x$ is $nk+1$ $nk$ $nk1$ $nk2$
answered
Mar 7
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

4k
views
gate2003
normal
binarysearchtree
0
votes
2
answers
24
Ace Test Series: Programming & DS  Binary Search Trees
I am stuck after JAN. It is not getting balanced even after 2 rotations. Can somebody help?
answered
Mar 6
in
DS
by
abhishekmehta4u
Boss
(
33.4k
points)

259
views
acetestseries
datastructure
binarysearchtree
avltree
+20
votes
9
answers
25
GATE199819b
Compute the post fix equivalent of the following expression $3^*\log(x+1)\frac{a}{2}$
answered
Mar 6
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

2.9k
views
gate1998
stack
infixpostfix
+34
votes
3
answers
26
GATE200747
Consider the process of inserting an element into a $Max \: Heap$, where the $Max \: Heap$ is represented by an $array$. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of $comparisons$ performed is: $\Theta(\log_2n)$ $\Theta(\log_2\log_2n)$ $\Theta(n)$ $\Theta(n\log_2n)$
answered
Mar 6
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

4.1k
views
gate2007
datastructure
heap
normal
+27
votes
3
answers
27
GATE199712
Consider a hash table with $n$ buckets, where external (overflow) chaining is used to resolve collisions. The hash function is such that the probability that a key value is hashed to a particular bucket is $\frac{1}{n}$. The hash table is initially empty and ... has occurred in any of the $K$ insertions? What is the probability that the first collision occurs at the $K^{th}$ insertion?
answered
Mar 5
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

2.4k
views
gate1997
datastructure
hashing
probability
normal
+17
votes
4
answers
28
GATE199615
Insert the characters of the string $K \ R \ P \ C \ S \ N \ Y \ T \ J \ M$ into a hash table of size $10$. Use the hash function $h(x)=( ord (x) – ord ("a") + 1) \mod 10$ and linear probing to resolve collisions. Which insertions cause collisions? Display the final hash table.
answered
Mar 5
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

1.8k
views
gate1996
datastructure
hashing
normal
+23
votes
4
answers
29
GATE19891vii, ISRO201514
A hash table with ten buckets with one slot per bucket is shown in the following figure. The symbols $S1$ to $S7$ initially entered using a hashing function with linear probing.The maximum number of comparisons needed in searching an item that is not present is $4$ $5$ $6$ $3$
answered
Mar 5
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

6.2k
views
hashing
isro2015
gate1989
datastructure
normal
+30
votes
7
answers
30
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$ ... 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 ___________.
answered
Mar 5
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

7.1k
views
gate20161
datastructure
graphs
normal
numericalanswers
+77
votes
6
answers
31
GATE2007IT29
When searching for the key value $60$ in a binary search tree, nodes containing the key values $10, 20, 40, 50, 70, 80, 90$ are traversed, not necessarily in the order given. How many different orders are possible in which these key values can occur on the search path from the root to the node containing the value $60$? $35$ $64$ $128$ $5040$
answered
Feb 28
in
DS
by
Kuljeet Shan
Active
(
1.1k
points)

9.9k
views
gate2007it
datastructure
binarysearchtree
normal
0
votes
0
answers
32
JNU , DS TREE, INORDER
If inorder traversing a tree results in E A C K F H D B G, the preorder traversal would return (a) FAEKCDBHG (b) FAEKCDHGB (c) EAFKHDCBG (d) FEAKDCHBG
asked
Feb 24
in
DS
by
8676rau
(
11
points)

139
views
0
votes
0
answers
33
DataStructureDeQueue
Suppose a dequeue is stored in a circular array with N memory cells. At which of the following condition is the dequeue is full? (i) LEFT = N and RIGHT = 1 (ii) LEFT = RIGHT + 1 (iii) LEFT = 1 and RIGHT = N (iv) LEFT = RIGHT  1 + N (i) and (iii) (iii) and (iv) (ii) and (iii) (i) and (iv)
asked
Feb 24
in
DS
by
Abhisek Tiwari 4
Active
(
4.4k
points)

74
views
0
votes
0
answers
34
self doubt
somewhere we seen that formula How many binary tree possible without labeled =c(2n,n)/n+1. anybody explain how we get this formula.
asked
Feb 23
in
DS
by
sandeep singh gaur
(
255
points)

45
views
#binary
tree
+4
votes
6
answers
35
GATE201946
Let $T$ be a full binary tree with $8$ leaves. (A full binary tree has every level full.) Suppose two leaves $a$ and $b$ of $T$ are chosen uniformly and independently at random. The expected value of the distance between $a$ and $b$ in $T$ (ie., the number of edges in the unique path between $a$ and $b$) is (rounded off to $2$ decimal places) _________.
answered
Feb 19
in
DS
by
pratekag
(
469
points)

4.4k
views
gate2019
numericalanswers
datastructure
binarytree
0
votes
1
answer
36
MCA ARRAY ADDRESS CALCULATION
Find the address of the position [10, 11, 12] of array A in column major order? Given Dimension is A[1:10, 5:15, 10:15], w is two word count, and Base address is 200.
answered
Feb 19
in
DS
by
omprakash889
(
23
points)

63
views
0
votes
1
answer
37
ARRAY
A Sorted array of n elements contains 0 and 1 to find out majority of 0 and 1.How much time it will take??? and please explain Meaning majority of 0 and 1??
answered
Feb 19
in
DS
by
Priyadrasta Raut
(
373
points)

68
views
#array
0
votes
1
answer
38
NIELIT 201854
______ to evaluate an expression without any embedded function calls. Two stacks are required one stack is needed Three stacks are required More than three stacks are required
answered
Feb 18
in
DS
by
Priyadrasta Raut
(
373
points)

30
views
nielit2018
stack
expressionevaluation
+25
votes
10
answers
39
GATE2007IT28
Consider a hash function that distributes keys uniformly. The hash table size is $20$. After hashing of how many keys will the probability that any new key hashed collides with an existing one exceed $0.5$. $5$ $6$ $7$ $10$
answered
Feb 16
in
DS
by
saurav raghaw
Active
(
1.4k
points)

5k
views
gate2007it
datastructure
hashing
probability
normal
+27
votes
4
answers
40
GATE2014341
Consider the pseudocode given below. The function $DoSomething()$ takes as argument a pointer to the root of an arbitrary tree represented by the $leftMostChildrightSibling$ representation. Each node of the tree is of type $treeNode$. typedef struct treeNode* treeptr; ... tree. height of the tree. number of nodes without a right sibling in the tree. number of leaf nodes in the tree
answered
Feb 15
in
DS
by
blackcloud
(
21
points)

4.4k
views
gate20143
datastructure
trees
normal
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
Recent Posts
IIT BHUBANESWAR MTECH WRITTEN TEST/INTERVIEW
GATE score validity queries.
How to prepare for IISC Interdisciplinary Mathematical Sciences Interview
GO Hardcopy for GATE 2020
How to prepare for BARC interview
All categories
General Aptitude
1.6k
Engineering Mathematics
7.5k
Digital Logic
3k
Programming & DS
4.9k
Programming
3.6k
DS
1.3k
Algorithms
4.3k
Theory of Computation
6k
Compiler Design
2.1k
Operating System
4.2k
Databases
4.2k
CO & Architecture
3.5k
Computer Networks
4.2k
Non GATE
1.4k
Others
1.5k
Admissions
584
Exam Queries
571
Tier 1 Placement Questions
23
Job Queries
72
Projects
18
Follow @csegate
Recent questions and answers in DS
Recent Blog Comments
10000 to <2000 is really kind of achievement , my...
THey removed it this year... I did not check it,...
even though i am not going for iiit , can you...
I don't think IIITD requires any codechef...
Will apply for IIITB. IIIT D requires a codechef...
50,115
questions
53,224
answers
184,676
comments
70,473
users