What are the operations that could be performed in O(logn) time complexity by red-black tree?

Category: QuestionsWhat are the operations that could be performed in O(logn) time complexity by red-black tree?
Editor">Editor Staff asked 4 weeks ago

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
Editor">Editor Staff answered 4 weeks ago

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.