How many rotations are required during the construction of an AVL tree if the following elements are to be added in the given sequence?

35, 50, 40, 25, 30, 60, 78, 20, 28

  1. 2 left rotations, 2 right rotations
  2. 2 left rotations, 3 right rotations
  3. 3 left rotations, 2 right rotations
  4. 3 left rotations, 1 right rotation

Answer (Detailed Solution Below)

Option 3 : 3 left rotations, 2 right rotations

Detailed Solution

Download Solution PDF

The correct answer is Option 3

Explanation:

 Right Rotate = 1 ⇒   Left Rotate = 1 ⇒

   Right Rotate = 1 ⇒   

Right Rotate = 1 ⇒ Left Rotate = 1 ⇒ 

More Binary Heap Questions

Hot Links: teen patti gold download apk teen patti classic teen patti master 2024 teen patti download apk teen patti earning app