Tree Data Structures questions — page 2 of 3

Q5

GATE CS 2020 CSTree Data StructuresMCQ1 mark−1/3 if wrong
The preorder traversal of a binary search tree is 15, 10, 12, 11, 20, 18, 16, 19.

Which one of the following is the postorder traversal of the tree?
Show answer without attempting

Answer: B

Q41

GATE CS 2020 CSTree Data StructuresMCQ2 marks−2/3 if wrong
In a balanced binary search tree with nn elements, what is the worst case time complexity of reporting all elements in range [a,b][a, b]? Assume that the number of reported elements is kk.
Show answer without attempting

Answer: B

Q47

GATE CS 2020 CSTree Data StructuresNAT2 marks
Consider the array representation of a binary min-heap containing 1023 elements. The minimum number of comparisons required to find the maximum in the heap is __________.
Show answer without attempting

Answer: 511

Q40

GATE CS 2019 CSTree Data StructuresMCQ2 marks−2/3 if wrong
Consider the following statements:
I. The smallest element in a max-heap is always at a leaf node
II. The second largest element in a max-heap is always a child of the root node
III. A max-heap can be constructed from a binary search tree in Θ(n)\Theta(n) time
IV. A binary search tree can be constructed from a max-heap in Θ(n)\Theta(n) time

Which of the above statements are TRUE?
Show answer without attempting

Answer: A

Q20

GATE CS 2018 CSTree Data StructuresNAT1 mark
The postorder traversal of a binary tree is 8,9,6,7,4,5,2,3,18,9,6,7,4,5,2,3,1. The inorder traversal of the same tree is 8,6,9,4,7,2,5,1,38,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 ______.
Show answer without attempting

Answer: 4

Q46

GATE CS 2018 CSTree Data StructuresNAT2 marks
The number of possible min-heaps containing each value from {1,2,3,4,5,6,7}\{1, 2, 3, 4, 5, 6, 7\} exactly once is _____.
Show answer without attempting

Answer: 80

Q6

GATE CS 2017 CS-1Tree Data StructuresMCQ1 mark−1/3 if wrong
Let TT be a binary search tree with 1515 nodes. The minimum and maximum possible heights of TT are:
Note: The height of a tree with a single node is 0.
Show answer without attempting

Answer: B

Q36

GATE CS 2017 CS-2Tree Data StructuresMCQ2 marks−2/3 if wrong
The pre-order traversal of a binary search tree is given by 12,8,6,2,7,9,10,16,15,19,17,2012, 8, 6, 2, 7, 9, 10, 16, 15, 19, 17, 20. Then the post-order traversal of this tree is:
Show answer without attempting

Answer: B

Q37

GATE CS 2016 CS-1Tree Data StructuresMCQ2 marks−2/3 if wrong
An operator delete(i) for a binary heap data structure is to be designed to delete the item in the i-th node. Assume that the heap is implemented in an array and i refers to the i-th index of the array. If the heap tree has depth d (number of edges on the path from the root to the farthest leaf), then what is the time complexity to re-fix the heap efficiently after the removal of the element?
Show answer without attempting

Answer: B

Q11

GATE CS 2016 CS-2Tree Data StructuresNAT1 mark
Breadth First Search (BFS) is started on a binary tree beginning from the root vertex. There is a vertex tt at a distance four from the root. If tt is the nn-th vertex in this BFS traversal, then the maximum possible value of nn is _________.
Show answer without attempting

Answer: 31.0

Q34

GATE CS 2016 CS-2Tree Data StructuresNAT2 marks
A complete binary min-heap is made by including each integer in [1,1023][1, 1023] exactly once. The depth of a node in the heap is the length of the path from the root of the heap to that node. Thus, the root is at depth 0. The maximum depth at which integer 9 can appear is _________.
Show answer without attempting

Answer: 8.0

Q36

GATE CS 2016 CS-2Tree Data StructuresMCQ2 marks−2/3 if wrong
Consider the following New-order strategy for traversing a binary tree:
- Visit the root;
- Visit the right subtree using New-order;
- Visit the left subtree using New-order;

The New-order traversal of the expression tree corresponding to the reverse polish expression
3 4 * 5 - 2 ^ 6 7 * 1 + -
is given by:
Show answer without attempting

Answer: C

Q40

GATE CS 2016 CS-2Tree Data StructuresNAT2 marks
The number of ways in which the numbers 1,2,3,4,5,6,71, 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.
Show answer without attempting

Answer: 64.0

Q21

GATE CS 2015 CS-3Tree Data StructuresNAT1 mark
Consider a binary tree T that has 200 leaf nodes. Then, the number of nodes in T that have exactly two children are ____________.
Show answer without attempting

Answer: 199

Q27

GATE CS 2015 CS-3Tree Data StructuresMCQ1 mark−1/3 if wrong
While inserting the elements 71,65,84,69,67,8371, 65, 84, 69, 67, 83 in an empty binary search tree (BST) in the sequence shown, the element in the lowest level is
Show answer without attempting

Answer: B

Q30

GATE CS 2015 CS-3Tree Data StructuresMCQ1 mark−1/3 if wrong
Consider the following array of elements.

(89,19,50,17,12,15,2,5,7,11,6,9,100)(89, 19, 50, 17, 12, 15, 2, 5, 7, 11, 6, 9, 100)

The minimum number of interchanges needed to convert it into a max-heap is
Show answer without attempting

Answer: D

Q15

GATE CS 2015 CS-1Tree Data StructuresMCQ1 mark−1/3 if wrong
The height of a tree is the length of the longest root-to-leaf path in it. The maximum and minimum number of nodes in a binary tree of height 5 are
Show answer without attempting

Answer: A

Q17

GATE CS 2015 CS-1Tree Data StructuresMCQ1 mark−1/3 if wrong
Which of the following is/are correct inorder traversal sequence(s) of binary search tree(s)?

I. 3, 5, 7, 8, 15, 19, 25
II. 5, 8, 9, 12, 10, 15, 25
III. 2, 7, 10, 8, 14, 16, 20
IV. 4, 6, 7, 9, 18, 20, 25
Show answer without attempting

Answer: A

Q35

GATE CS 2015 CS-1Tree Data StructuresMCQ1 mark−1/3 if wrong
What are the worst-case complexities of insertion and deletion of a key in a binary search tree?
Show answer without attempting

Answer: B

Q37

GATE CS 2015 CS-1Tree Data StructuresMCQ2 marks−2/3 if wrong
Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4.
Array Index123456789
Value4030201015161784
Now consider that a value 35 is inserted into this heap. After insertion, the new heap is
Show answer without attempting

Answer: B

0/200 correct0 marks

Related topics in Programming and Data Structures