Data Structures & AlgorithmsVery hardGATE CS · Codeforces Div 2

Keys [7, 34, 44, 32, 10, 49, 20] are inserted, in this order, into an empty AVL tree using the standard rebalancing (left, right, left–right and right–left cases). How many rotation operations are performed in total, where a double rotation counts as two single rotations?

  1. A. 4
  2. B. 3
  3. C. 2
  4. D. 7

Correct answer: B. 3

The insertions trigger 2 rebalancing events; the double rotations add 2 each, giving 3 rotation operations. Counting events, or the final height, is not the same quantity.

More Trees, Graphs, Recursion and Dynamic Programming questions

Exams that ask this topic