fix: typos

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-05-18 23:34:27 +02:00
parent ebe689c25d
commit ecccb2b10e
Signed by: mfocko
GPG key ID: 7C47D46246790496
3 changed files with 8 additions and 6 deletions

View file

@ -29,7 +29,7 @@ The meaning of the \textit{AVL Rule} is quite simple since rank represents the h
\item \textbf{(1,~2)-node} represents a tree where one of its subtrees has a bigger height. In this case, we are talking about the nodes with balance factor $-1$ or $1$ (respectively being signed with a $-$ or a $+$). \item \textbf{(1,~2)-node} represents a tree where one of its subtrees has a bigger height. In this case, we are talking about the nodes with balance factor $-1$ or $1$ (respectively being signed with a $-$ or a $+$).
\end{itemize} \end{itemize}
Example of the AVL tree that uses ranks instead of signs or balance-factors can be seen in \autoref{fig:ranked:avl}. Example of the AVL tree that uses ranks instead of signs or balance factors can be seen in \autoref{fig:ranked:avl}.
\begin{figure} \begin{figure}
\centering \centering
\begin{tikzpicture}[>=latex',line join=bevel,scale=0.75,] \begin{tikzpicture}[>=latex',line join=bevel,scale=0.75,]
@ -161,7 +161,7 @@ When propagating the error, we can encounter 3 cases (we explain them for propag
Knowing rules, we have implemented the deletion rebalance by implementing the following functions: Knowing rules, we have implemented the deletion rebalance by implementing the following functions:
\begin{enumerate} \begin{enumerate}
\item \avlDeleteRebalance{} that handles updating the current node and its parent and iteratively calls subroutine handling previously described \textit{as one step of a rebalancing}. \item \avlDeleteRebalance{} that handles updating the current node and its parent and iteratively calls subroutine handling previously described as \textit{one step of a rebalancing}.
\item \avlDeleteFixNode{} that handles one adjustment of rebalancing as described above. \item \avlDeleteFixNode{} that handles one adjustment of rebalancing as described above.
\item \avlDeleteRotate{} that handles rotation and updating of ranks, if necessary. \item \avlDeleteRotate{} that handles rotation and updating of ranks, if necessary.
\end{enumerate} \end{enumerate}
@ -245,4 +245,6 @@ There are two operations that are not described using helper functions, and they
\texttt{deleteRotate} is handling only fixes where the rotations are required. Both \autoref{algorithm:avl:deleteFixNode} and \autoref{algorithm:avl:deleteRotate} include comments to highlight which rules are handled. This function is also done generically regardless of the subtree from which the height change is being propagated. This is done by passing in functions used for rotations (since it is mirrored) and passing in the balance factor required for just one rotation. \texttt{deleteRotate} is handling only fixes where the rotations are required. Both \autoref{algorithm:avl:deleteFixNode} and \autoref{algorithm:avl:deleteRotate} include comments to highlight which rules are handled. This function is also done generically regardless of the subtree from which the height change is being propagated. This is done by passing in functions used for rotations (since it is mirrored) and passing in the balance factor required for just one rotation.
There is a crucial difference between \autoref{algorithm:avl:deleteFixNode} and \autoref{algorithm:avl:deleteRotate} compared to the AVL tree implementations without ranks. If we compare the rules for deletion with algorithms for rank-balanced implementation, we can see a crucial difference. During propagation of the height change, the balance factors of the closest nodes are already adjusted. That is caused by the calculation of the balance factor based on the subtrees, not the node's rank. Furthermore, subtrees are already adjusted. This fact needs to be reflected in the implementation accordingly. It shifts the meaning of the rules described above and is written for the implementations that directly store the trit in the nodes, and update it manually during rebalancing. There is a crucial difference between \autoref{algorithm:avl:deleteFixNode} and \autoref{algorithm:avl:deleteRotate} compared to the AVL tree implementations without ranks. During propagation of the height change, the balance factors of the closest nodes are already adjusted. That is caused by calculating the balance factor based on the subtrees, not the node's rank. This fact needs to be reflected in the implementation accordingly. It changes the meaning of the rules described above since they are written for the implementations that directly store the trit in the nodes and update it manually during rebalancing.
It is rare for standard algorithms for the AVL tree to work with a balance factor. The reasoning is straightforward. The balance factor is calculated using the heights of the subtrees, which is not a cheap operation without any additional information. However, when rank represents the height of the subtree, we get that information just at the cost of keeping it correct. Every time we access the balance factor in our delete algorithm, it is done in $\mathcal{O}(1)$ as opposed to the need to calculate the heights.

View file

@ -3,7 +3,7 @@
In this thesis, we have presented a different view on the balancing of the binary search trees, and that is the rank-balanced tree as described by \textit{Haeupler et al.}~\cite{wavl}. Apart from describing the algorithms that implement the AVL tree using the rank-balanced tree, we have also described the WAVL tree, a relaxation of the AVL tree presented in the article mentioned above. In this thesis, we have presented a different view on the balancing of the binary search trees, and that is the rank-balanced tree as described by \textit{Haeupler et al.}~\cite{wavl}. Apart from describing the algorithms that implement the AVL tree using the rank-balanced tree, we have also described the WAVL tree, a relaxation of the AVL tree presented in the article mentioned above.
All of the rules that were presented are tied to the self-balancing binary search trees that base their balancing on the height of the tree. During the implementation and experiments, we have concluded that it should also be possible to implement a self-balanced binary tree that bases the balancing on the sizes of the subtrees rather than their heights. An example of such tree is mentioned in the \textit{Functional Pearls: Efficient sets -- a balancing act} by \textit{Stephen Adams}~\cite{adams_1993}. Therefore, we conclude that rank as a balancing tool is quite flexible. All of the rules that were presented are tied to the self-balancing binary search trees that base their balancing on the height of the tree. During the implementation and experiments, we have concluded that it should also be possible to implement a self-balanced binary tree that bases the balancing on the sizes of the subtrees rather than their heights. An example of such tree is described in the \textit{Functional Pearls: Efficient sets -- a balancing act} by \textit{Stephen Adams}~\cite{adams_1993}. Therefore, we conclude that rank as a balancing tool is quite flexible.
The thesis also includes the implementation of the rank-balanced tree in Python for the AVL, WAVL and rAVL trees with a set of property-based tests that can be used to verify any part of the implementation. The thesis also includes the implementation of the rank-balanced tree in Python for the AVL, WAVL and rAVL trees with a set of property-based tests that can be used to verify any part of the implementation.

View file

@ -26,7 +26,7 @@ One of the core differences between AVL and WAVL lies in the rebalancing after d
From the previous 2 statements, we can come to 2 conclusions, and those are: From the previous 2 statements, we can come to 2 conclusions, and those are:
\begin{itemize} \begin{itemize}
\item If we commit only insertions to the WAVL tree, it will always yield a valid AVL tree. In that case, the height boundaries are the same as of the AVL tree (described in \autoref{avl-height}). \item If we commit only insertions to the WAVL tree, it will always yield a valid AVL tree. In that case, the height boundaries are the same as of the AVL tree (described in \autoref{avl-height}).
\item If we also commit deletions, we can assume the worst-case scenario where \[ h < 2 \log_2{n} \] \item If we also commit deletions, we can assume the worst-case scenario where \[ h \leq 2 \log_2{n} \]
This scenario is close to the upper bound of the height for the red-black trees (described in \autoref{rb-height}). This scenario is close to the upper bound of the height for the red-black trees (described in \autoref{rb-height}).
\end{itemize} \end{itemize}
@ -351,7 +351,7 @@ The final part happens when it is not possible to propagate the error further. I
\section{Heuristics} \section{Heuristics}
\textit{Haeupler et al.}~\cite{wavl} also present different heuristics for the rebalancing of the WAVL tree. In this thesis, we present algorithms for bottom-up rebalancing. Regarding top-down rebalancing, it can be compared to the preemptive algorithms on the B-tree that we mentioned in \autoref{chap:sb-bst}. It can be described in the following way: \textit{Haeupler et al.}~\cite{wavl} also present different heuristics for the rebalancing of the WAVL tree. In this thesis, we present algorithms for bottom-up rebalancing. Top-down rebalancing can be compared to the preemptive algorithms on the B-tree that we mentioned in \autoref{chap:sb-bst}. It can be described in the following way:
When inserting the key to the WAVL tree, we promote every (1,~1)-node that we encounter on the way down to the parent node. When inserting the key to the WAVL tree, we promote every (1,~1)-node that we encounter on the way down to the parent node.