In the given figure, find ‘?’.

Category: QuestionsIn the given figure, find ‘?’.
Editor">Editor Staff asked 3 months ago

In the given figure, find ‘?’.
(a) left rotation
(b) right rotation
(c) insertion
(d) deletion
The origin of the question is Binary Trees topic in section Binary Trees of Data Structures & Algorithms I
The question was posed to me during an internship interview.

1 Answers
Editor">Editor Staff answered 3 months ago

The correct option is (b) right rotation
Easiest explanation – B is initially the right child of X. It is then rotated right side and now, B is the left child of P.