UGC NET Paper 2 (Computer Science)Hard

Keys 30, 10, 20 are inserted in this order into an empty AVL tree. The rebalancing needed and the resulting root are:

  1. A. Single right rotation, root 10
  2. B. Left-right double rotation, root 20
  3. C. Single left rotation, root 30
  4. D. Right-left double rotation, root 20

Correct answer: B. Left-right double rotation, root 20

30 with left child 10 and 10's right child 20 is a left-right case; after rotations 20 is the root.

More UGC NET Computer Science and Applications questions

Exams that ask this topic