1.

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 neededQuestion is taken from Red Black Tree topic in division Binary Trees of Data Structures & Algorithms II had been asked this question in an international level competition.

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.



Discussion

No Comment Found

Related InterviewSolutions