Question: In Java with inline comments, Illustrate what happens when the sequence 1, 5, 2, 4, 3 is added to an empty ScapegoatTree, and show where
In Java with inline comments, Illustrate what happens when the sequence 1, 5, 2, 4, 3 is added to an empty ScapegoatTree, and show where the credits described in the proof of Lemma 8.3 go, and how they are used during this sequence of additions
Lemme 8.3 below:

Lemma 8.3: Starting with an empty ScapegoatTree any sequence of m add(x) and remove(x) operations causes at most Om log m) time to be used by rebuild(u) opera- tions. Proof: To prove this, we will use a credit scheme. We imagine that each node stores a number of credits. Each credit can pay for some constant, c, units of time spent rebuilding. The scheme gives out a total of O(m log m) credits and every call to rebuild(u) is paid for with credits stored at u. During an insertion or deletion, we give one credit to each node on the path to the inserted node, or deleted node, u. In this way we hand out at most log3/29 size(u.right) si and therefore size(u.left) size(u.right) > siz size(u.left) > 1 size(u) Now, the last time a subtree containing u was rebuilt (or when u was inserted, if a subtree containing u was never rebuilt), we had size(u.left) - size(u.right) 2n. In this case, we have q-n>n credits stored on the side," and we use these to pay for the O(n) time it takes to rebuild the root. This completes the proof. Lemma 8.3: Starting with an empty ScapegoatTree any sequence of m add(x) and remove(x) operations causes at most Om log m) time to be used by rebuild(u) opera- tions. Proof: To prove this, we will use a credit scheme. We imagine that each node stores a number of credits. Each credit can pay for some constant, c, units of time spent rebuilding. The scheme gives out a total of O(m log m) credits and every call to rebuild(u) is paid for with credits stored at u. During an insertion or deletion, we give one credit to each node on the path to the inserted node, or deleted node, u. In this way we hand out at most log3/29 size(u.right) si and therefore size(u.left) size(u.right) > siz size(u.left) > 1 size(u) Now, the last time a subtree containing u was rebuilt (or when u was inserted, if a subtree containing u was never rebuilt), we had size(u.left) - size(u.right) 2n. In this case, we have q-n>n credits stored on the side," and we use these to pay for the O(n) time it takes to rebuild the root. This completes the proof
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
