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 sorting
Query is from Red Black Tree in division Binary Trees of Data Structures & Algorithms I
This question was posed to me in unit test.
1 Answers
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.