Search⌘ K

Exercise: Scapegoat Trees

Explore how to modify the add(x) method in Scapegoat Trees to improve efficiency by not recomputing subtree sizes already calculated. Understand the optimization techniques for maintaining tree balance and enhancing performance in this exercise.

We'll cover the following...

Task

Modify the add(x) method of the ScapegoatTree so that it does not waste any time recomputing the sizes of subtrees that have already been computed. This is ...