fix(wavl): minor notation changes

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-05-18 14:00:12 +02:00
parent 2ccfbb6834
commit 9532397ede
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -108,7 +108,7 @@ Rebalancing of the tree is equivalent to rebalancing of AVL tree and is executed
\begin{algorithm}
\Proc{$\texttt{insertRebalance}(T, node)$}{
\tcp{Handles \hyperref[avl:rules:insert:2]{rule 2}}
\While{$node.parent \neq nil \land (node.parent\, is\, (0, 1)\, or\, (1, 0))$}{
\While{$node.parent \neq nil \land node.parent \text{ is (0,1)-node}$}{
$\texttt{promote}(node.parent)$\;
$node \gets node.parent$\;
}
@ -165,11 +165,11 @@ Here we can see, once again, an interesting pattern. When comparing to the algor
\begin{algorithm}
\Proc{$\texttt{deleteRebalance}(T, y, parent)$}{
\uIf{$y \text{ is (2, 2)}$}{
\uIf{$y \text{ is (2, 2)-node}$}{
$\texttt{demote}(y)$\;
$parent \gets y.parent$\;
}
\ElseIf{$parent \text{ is (2, 2)}$}{
\ElseIf{$parent \text{ is (2, 2)-node}$}{
$\texttt{demote}(parent)$\;
$parent \gets parent.parent$\;
}
@ -186,7 +186,7 @@ Here we can see, once again, an interesting pattern. When comparing to the algor
\caption{Initial phase of algorithm for the rebalance after deletion from the WAVL tree}\label{algorithm:wavl:deleteRebalance}
\end{algorithm}
As described by \textit{Haeupler et al.}, we start the deletion rebalancing by checking for (2, 2) node. If that is the case, we demote it and continue with the deletion rebalancing via \autoref{algorithm:wavl:bottomUpDelete} if we have created a 3-child by the demotion. Demoting the (2, 2) node is imperative, since it enforces part of the \textit{Weak AVL Rule} requiring that leaves have rank equal to zero.
As described by \textit{Haeupler et al.}~\cite{wavl}, we start the deletion rebalancing by checking for (2, 2) node. If that is the case, we demote it and continue with the deletion rebalancing via \autoref{algorithm:wavl:bottomUpDelete} if we have created a 3-child by the demotion. Demoting the (2, 2) node is imperative, since it enforces part of the \textit{Weak AVL Rule} requiring that leaves have rank equal to zero.
For example consider the following tree in \autoref{fig:wavl:twoElements}. Deletion of key 2 from that tree would result in having only key 1 in the tree with rank equal to 1, which would be (2, 2) node and leaf at the same time. After the demotion of the remaining key, we acquire the tree as shown in \autoref{fig:wavl:twoElementsAfterDelete}
@ -239,7 +239,7 @@ In contrast to the \textit{AVL Rule}, WAVL tree allows us to have (2, 2) nodes p
$y \gets parent.left$\;
}
\BlankLine
\While{$parent \neq nil \land x \text{ is 3-child} \land (y \text{ is 2-child or (2, 2)})$}{
\While{$parent \neq nil \land x \text{ is 3-child} \land (y \text{ is 2-child or (2, 2)-node})$}{
\If{$y \text{ is not 2-child}$}{
$\texttt{demote}(y)$\;
}
@ -258,7 +258,7 @@ In contrast to the \textit{AVL Rule}, WAVL tree allows us to have (2, 2) nodes p
}
}
\BlankLine
\If{$parent \text{ is not (1, 3)}$}{
\If{$parent \text{ is not (1, 3)-node}$}{
\Return\;
}
$p \gets parent$\;