63 views

edited | 63 views

option B) $O(lg n)$

Red-Black trees are always 'balanced' means at any moment both the left and right subtrees will be nearly of the same height (maximum difference between heights is 1).

Search: The worst case is when node being searched is a leaf node. This takes lg n time which is the height of the tree.

Insert: The worst case happens when every node from root to the leaf has to be balanced which can be done in lg n time.

Delete: The worst case happens when every node from the node to root has to be balanced which can be done in lg n time.

So the worst case is time is $O(lgn)$
answered by Junior (741 points)
edited
0
how????
–1
+1
@ venkat

see one thing, U r answering, its fine but u know along with it if u could answer in some informative way so that other people can also take help from it...
0
@venkat_sirvisetti, Can you please support your answer with an Example?Say?