fix(bst): add footnotes

Signed-off-by: Matej Focko <mfocko@redhat.com>
This commit is contained in:
Matej Focko 2022-05-18 11:33:27 +02:00
parent 0afce998e0
commit 5531b4187a
Signed by: mfocko
GPG key ID: 7C47D46246790496

View file

@ -11,7 +11,7 @@ As mentioned previously, red-black trees are among the most popular implementati
\item For each internal node, all paths from it to external nodes contain the same number of black nodes. \item For each internal node, all paths from it to external nodes contain the same number of black nodes.
\item No path from an internal node to an external node contains two red nodes in a row. \item No path from an internal node to an external node contains two red nodes in a row.
\item External nodes do not hold any data. \item External nodes do not hold any data.
\item Root has black colour. This rule is optional, since it increases the count of black nodes from root to each of the external nodes. However it may be beneficial during insertion. \item Root has black colour.~\footnote{This rule is optional, since it increases the count of black nodes from root to each of the external nodes. However it may be beneficial during insertion, e.g. 2 insertions into empty red-black tree.}
\end{enumerate} \end{enumerate}
Given this knowledge, we can safely deduce the following relation between the height of the red-black tree and nodes stored in it~\cite{cormen2009introduction}: Given this knowledge, we can safely deduce the following relation between the height of the red-black tree and nodes stored in it~\cite{cormen2009introduction}:
@ -23,7 +23,7 @@ Lower bound is given by a perfect binary tree and the upper bound is given by th
There are also other variants of the red-black tree that are considered to be simpler for implementation, e.g. left-leaning red-black tree, as described by \textit{Sedgewick}~\cite{llrb}. There are also other variants of the red-black tree that are considered to be simpler for implementation, e.g. left-leaning red-black tree, as described by \textit{Sedgewick}~\cite{llrb}.
Red-black trees are used to implement sets in C++~\cite{llvm}, Java and C\#. Red-black trees are used to implement sets in C++~\footnote{\url{https://github.com/llvm/llvm-project/blob/main/libcxx/include/__tree} as of commit \texttt{990ea39}}, Java~\footnote{\url{https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/TreeMap.java} as of commit \texttt{fb469fb}} and C\#~\footnote{\url{https://github.com/dotnet/runtime/blob/main/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs} as of commit \texttt{215b39a}}.
\section{AVL tree} \section{AVL tree}
@ -49,7 +49,7 @@ Similarly, we will deduce the height of the AVL tree from original paper, by \te
If we compare the upper bounds for the height of the red-black trees and AVL trees, we can see that AVL rules are more strict than red-black rules, but at the cost of rebalancing. However, in both cases the rebalancing still takes $\log_2{n}$. If we compare the upper bounds for the height of the red-black trees and AVL trees, we can see that AVL rules are more strict than red-black rules, but at the cost of rebalancing. However, in both cases the rebalancing still takes $\log_2{n}$.
Regarding the implementation of AVL trees, we can see them implemented in the standard library of Agda or Coq. Regarding the implementation of AVL trees, we can see them implemented in the standard library of Agda~\footnote{\url{https://github.com/agda/agda-stdlib/blob/master/src/Data/Tree/AVL.agda} as of commit \texttt{d0841d1}}, OCaml~\footnote{\url{https://github.com/ocaml/ocaml/blob/trunk/stdlib/set.ml} as of commit \texttt{f52fdc2}} or Coq~\footnote{\url{https://github.com/coq/coq/blob/master/theories/MSets/MSetAVL.v} as of commit \texttt{c1ddf13}; they also admit to follow the OCaml implementation}.
\section {B-tree} \section {B-tree}