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 Answers
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.