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 5 months 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 5 months 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.


Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17

Notice: Trying to get property 'ID' of non-object in /home/fvckxqmi/public_html/wp-content/themes/blocksy/inc/single/single-helpers.php on line 17
Articles: 40701