I need to come up with an algorithm which performs n remove(x)operations on a left-child-right-sibling binary search tree with nnodes in theta(n*log(n)) time. The remove(x) procedure is supposedto remove the subtree starting at x and after the n operations ofremove(x), nodes in different subtrees must have different “color”attributes.
Obviously the problem can be solved naively in theta(n^2). Ican’t see how this boundary can be reduced though.
Expert Answer
An answer will be send to you shortly. . . . .