20.2 A recursive structure
20.21
Write pseudocode for the procedures $\text{PROTOvEBMAXIMUM}$ and $\text{PROTOvEBPREDECESSOR}$.
See the two algorithms, $\text{PROTOvEBMAXIMUM}$ and $\text{PROTOvEBPREDECESSOR}$.
20.22
Write pseudocode for $\text{PROTOvEBDELETE}$. It should update the appropriate summary bit by scanning the related bits within the cluster. What is the worstcase running time of your procedure?
1 2 3 4 5 6 7 8 9 10 11 12  PROTOvEBDELETE(V, x) if V.u == 2 V.A[x] = 0 else PROTOvEBDELETE(V.cluster[high(x)], low(x)) inCluster = false for i = 0 to sqrt(u)  1 if PROTOvEBMEMBER(V.cluster[high(x)], low(i)) inCluster = true break if inCluster == false PROTOvEBDELETE(V.summary, high(x)) 
When we delete a key, we need to check membership of all keys of that cluster to know how to update the summary structure. There are $\sqrt u$ of these, and each membership takes $O(\lg\lg u)$ time to check. With the recursive calls, recurrence for running time is
$$T(u) = T(\sqrt u) + O(\sqrt u\lg\lg u).$$
We make the substitution $m = \lg u$ and $S(m) = T(2^m)$. Then we apply the Master Theorem, using case 3, to solve the recurrence. Substituting back, we find that the runtime is $T(u) = O(\sqrt u\lg\lg u)$.
20.23
Add the attribute $n$ to each $\text{protovEB}$ structure, giving the number of elements currently in the set it represents, and write pseudocode for $\text{PROTOvEBDELETE}$ that uses the attribute $n$ to decide when to reset summary bits to $0$. What is the worstcase running time of your procedure? What other procedures need to change because of the new attribute? Do these changes affect their running times?
We would keep the same as before, but insert immediately after the else, a check of whether $n = 1$. If it doesn't continue as usual, but if it does, then we can just immediately set the summary bit to $0$, null out the pointer in the table, and be done immediately. This has the upside that it can sometimes save up to $\lg\lg u$. The procedure has the big downside that the number of elements that are in the set could be as high as $\lg(\lg u)$, in which case $\lg u$ many bits are needed to store $n$.
20.24
Modify the $\text{protovEB}$ structure to support duplicate keys.
The array $A$ found in a proto van Emde Boas structure of size $2$ should now support integers, instead of just bits. All other pats of the structure will remain the same. The integer will store the number of duplicates at that position. The modifications to insert, delete, minimum, successor, etc will be minor. Only the base cases will need to be updated.
20.25
Modify the $\text{protovEB}$ structure to support keys that have associated satellite data.
The only modification necessary would be for the $u = 2$ trees. They would need to also include a length two array that had pointers to the corresponding satellite data which would be populated in case the corresponding entry in $A$ were $1$.
20.26
Write pseudocode for a procedure that creates a $\text{protovEB}(u)$ structure.
This algorithm recursively allocates proper space and appropriately initializes attributes for a proto van Emde Boas structure of size $u$.
1 2 3 4 5 6 7 8 9 10  MAKEPROTOvEB(u) allocate a new vEB tree V V.u = u if u == 2 let A be an array of size 2 V.A[1] = V.A[0] = 0 else V.summary = MAKEPROTOvEB(sqrt(u)) for i = 0 to sqrt(u)  1 V.cluster[i] = MAKEPROTOvEB(sqrt(u)) 
20.27
Argue that if line 9 of $\text{PROTOvEBMINIMUM}$ is executed, then the $\text{protovEB}$ structure is empty.
For line 9 to be executed, we would need that in the summary data, we also had a $\text{NIL}$ returned. This could of either happened through line 9, or 6. Eventually though, it would need to happen in line 6, so, there must be some number of summarizations that happened of $V$ that caused us to get an empty $u = 2$ $\text{vEB}$. However, a summarization has an entry of one if any of the corresponding entries in the data structure are one. This means that there are no entries in $V$, and so, we have that $V$ is empty.
20.28
Suppose that we designed a $\text{protovEB}$ structure in which each cluster array had only $u^{1 / 4}$ elements. What would the running times of each operation be?
There are $u^{3 / 4}$ clusters in each $\text{protovEB}$.

MEMBER/INSERT:
$$T(u) = T(u^{1 / 4}) + O(1) = \Theta(\lg\log_4 u) = \Theta(\lg\lg u).$$

MINIMUM/MAXIMUM:
$$T(u) = T(u^{1 / 4}) + T(u^{3 / 4}) + O(1) = \Theta(\lg u).$$

SUCCESSOR/PREDECESSOR/DELETE:
$$T(u) = T(u^{1 / 4}) + T(u^{3 / 4}) + \Theta(\lg u^{1 / 4}) = \Theta(\lg u \lg\lg u).$$