GATE CS 2021 Set 1 | Question 20
Programming & Data Structures › Trees · MCQ · 1 mark · Answer: D
- Question 20Programming & Data Structuresmcq1 markA binary search tree contains distinct elements. What is the time complexity of picking an element in that is smaller than the maximum element in ?
- A.
- B.
- C.
- D.✓
Answer: D
Solution
The maximum is the right-most node, so the root (for ) is not the maximum. Returning the root (or any fixed non-maximum node) takes time. - A.
More GATE PYQ on Trees
All GATE CS Programming & Data Structures PYQ →Attempt GATE CS 2021 Set 1 in real GATE exam mode
Full paper with a timer, the GATE interface and a topic-wise analysis — free.
Create free account →