1.

What are the operations that could be performed in O(logn) time complexity by red-black tree?(a) insertion, deletion, finding predecessor, successor(b) only insertion(c) only finding predecessor, successor(d) for sortingQuery is from Red Black Tree in division Binary Trees of Data Structures & Algorithms IThis question was posed to me in unit test.

Answer» CORRECT option is (a) INSERTION, deletion, FINDING predecessor, successor

The explanation is: We impose restrictions to achieve logarithm time complexities.

impose restrictions are:

 . root property is black

 . every leaf is black

 . CHILDREN of red node are black

 . all leaves have same black.


Discussion

No Comment Found

Related InterviewSolutions