Open In App

Data Structures | Balanced Binary Search Trees | Question 13

Like Article
Like
Save Article
Save
Share
Report issue
Report

Which of the following is true

(A)

The AVL trees are more balanced compared to Red Black Trees, but they may cause more rotations during insertion and deletion.

(B)

Heights of AVL and Red-Black trees are generally same, but AVL Trees may cause more rotations during insertion and deletion.

(C)

Red Black trees are more balanced compared to AVL Trees, but may cause more rotations during insertion and deletion.

(D)

Heights of AVL and Red-Black trees are generally same, but Red Black trees may cause more rotations during insertion and deletion.


Answer: (A)

Explanation:

Red Black Tree with n nodes has height <= 2Log2(n+1) AVL Tree with n nodes has height less than Logφ(√5(n+2)) – 2. Therefore, the AVL trees are more balanced compared to Red Black Trees, but they may cause more rotations during insertion and deletion. So if your application involves many frequent insertions and deletions, then Red Black trees should be preferred. And if the insertions and deletions are less frequent and search is more frequent operation, then AVL tree should be preferred over Red Black Tree.


Quiz of this Question
Please comment below if you find anything wrong in the above post


Last Updated : 28 Jun, 2021
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads