+1 vote
in Data Structures & Algorithms I by (110k points)
When it would be optimal to prefer Red-black trees over AVL trees?

(a) when there are more insertions or deletions

(b) when more search is needed

(c) when tree must be balanced

(d) when log(nodes) time complexity is needed

Question is taken from Red Black Tree topic in division Binary Trees of Data Structures & Algorithms I

I had been asked this question in an international level competition.

1 Answer

+1 vote
by (672k points)
selected by
Best answer
Correct option is (a) when there are more insertions or deletions

For explanation: Though both trees are balanced, when there are more insertions and deletions to make the tree balanced, AVL trees should have more rotations, it would be better to use red-black. but if more search is required AVL trees should be used.

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.