+1 vote
in Data Structures & Algorithms I by (110k points)
Why to prefer red-black trees over AVL trees?

(a) Because red-black is more rigidly balanced

(b) AVL tree store balance factor in every node which costs space

(c) AVL tree fails at scale

(d) Red black is more efficient

This key question is from AVL Tree topic in section Binary Trees of Data Structures & Algorithms I

The question was asked in an online interview.

1 Answer

+1 vote
by (672k points)
selected by
 
Best answer
The correct choice is (b) AVL tree store balance factor in every node which costs space

The explanation is: Every node in an AVL tree need to store the balance factor (-1, 0, 1) hence space costs to O(n), n being number of nodes. but in red-black we can use the sign of number (if numbers being stored are only positive) and hence save space for storing balancing information. there are even other reasons where redblack is mostly prefered.

Related questions

Welcome to TalkJarvis QnA, a question-answer community website for the people by the people. On TalkJarvis QnA you can ask your doubts, curiosity, questions and whatever going in your mind either related to studies or others. Experts and people from different fields will answer.

Categories

...