1
$\begingroup$

According to Wikipedia: An augmented tree can be built from a simple ordered tree, for example a binary search tree or self-balancing binary search tree, ordered by the 'low' values of the intervals. An extra annotation is then added to every node, recording the maximum upper value among all the intervals from this node down. Maintaining this attribute involves updating all ancestors of the node from the bottom up whenever a node is added or deleted. This takes only O(h) steps per node addition or removal, where h is the height of the node added or removed in the tree. If there are any tree rotations during insertion and deletion, the affected nodes may need updating as well.

I am bit puzzled: Why can't one just update its ancestors after the new node (in case of insertion) has found its proper place in the tree after the rotations?

Also, I am not quite sure how to approach deletion.

$\endgroup$

1 Answer 1

1
$\begingroup$

You can update the ancestors. The Wikipedia article explains the running time to do so.

If you've done a rotation, you might need to update all nodes that participated in the rotation and all of their ancestors.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.