# Data Structures | Balanced Binary Search Trees | Question 5

Consider the following AVL tree.

```         60
/     \
20      100
/   \
80    120
```

Which of the following is updated AVL tree after insertion of 70

```A
70
/    \
60      100
/       /    \
20       80    120

B
100
/    \
60      120
/  \     /
20   70   80

C
80
/    \
60      100
/  \       \
20   70      120

D
80
/    \
60      100
/       /   \
20      70    120  ```

(A) A
(B) B
(C) C
(D) D

Explanation: Refer following for steps used in AVL insertion.

AVL Tree | Set 1 (Insertion)

```After insertion of 70, tree becomes following
60
/     \
20      100
/   \
80    120
/
70
```

We start from 50 and travel up. We keep travelling up till we find an unbalanced node. In above case, we reach the node 60 and see 60 got unbalanced after insertion and this is Right Left Case. So we need to apply two rotations

```         60                               60                            80
/     \       Right Rotate(100)  /      \     Left Rotate(60)   /    \
20      100    -----------------> 20        80 ---------------> 60      100
/   \                              /   \                /  \        \
80    120                          70     100            20   70       120
/                                            \
70                                             120
```
My Personal Notes arrow_drop_up
Article Tags :
Practice Tags :

Be the First to upvote.

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.