diff --git a/bibliography.bib b/bibliography.bib index 687270a..49e5332 100644 --- a/bibliography.bib +++ b/bibliography.bib @@ -150,3 +150,59 @@ url = {https://sedgewick.io/wp-content/uploads/2022/03/2008-09LLRB.pdf}, urldate = {2022-05-10} } + +@SOFTWARE{llvm, + author = {{LLVM Project}}, + title = {\texttt{\_\_tree}}, + url = {https://github.com/llvm/llvm-project/blob/main/libcxx/include/__tree}, + version = {commit \texttt{990ea39}}, + date = {2022-05-02}, +} + +@SOFTWARE{jdk, + author = {{Oracle and/or its affiliates}}, + title = {\texttt{TreeMap.java}}, + url = {https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/util/TreeMap.java}, + version = {commit \texttt{fb469fb}}, + date = {2022-05-02}, +} + +@SOFTWARE{csharp, + author = {{.NET Foundation and Contributors}}, + title = {\texttt{SortedSet.cs}}, + url = {https://github.com/dotnet/runtime/blob/main/src/libraries/System.Collections/src/System/Collections/Generic/SortedSet.cs}, + version = {commit \texttt{215b39a}}, + date = {2022-05-02}, +} + +@SOFTWARE{agda, + author = {Daggitt, Matthew and Allais, Guillaume}, + title = {\texttt{AVL.agda}}, + url = {https://github.com/agda/agda-stdlib/blob/master/src/Data/Tree/AVL.agda}, + version = {commit \texttt{d0841d1}}, + date = {2022-05-02}, +} + +@SOFTWARE{ocaml, + author = {{Institut National de Recherche en Informatique et en Automatique}}, + title = {\texttt{set.ml}}, + url = {https://github.com/ocaml/ocaml/blob/trunk/stdlib/set.ml}, + version = {commit \texttt{f52fdc2}}, + date = {2022-05-02}, +} + +@SOFTWARE{coq, + author = {{INRIA, CNRS and contributors}}, + title = {\texttt{MSetAVL.v}}, + url = {https://github.com/coq/coq/blob/master/theories/MSets/MSetAVL.v}, + version = {commit \texttt{c1ddf13}}, + date = {2022-05-02}, +} + +@SOFTWARE{rust, + author = {{LLVM Project}}, + title = {\texttt{\_\_tree}}, + url = {https://github.com/rust-lang/rust/blob/master/library/alloc/src/collections/btree/map.rs}, + version = {commit \texttt{9805437}}, + date = {2022-05-02}, +} diff --git a/self_balancing_search_trees.tex b/self_balancing_search_trees.tex index 035c164..05a4c29 100644 --- a/self_balancing_search_trees.tex +++ b/self_balancing_search_trees.tex @@ -23,7 +23,7 @@ The lower bound is given by a perfect binary tree, and the upper bound is given Other variants of the red-black tree 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++~\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}}. +Red-black trees are used to implement sets in C++~\cite{llvm}, Java~\cite{jdk} and C\#~\cite{csharp}. \section{AVL tree} @@ -48,7 +48,7 @@ Similarly, we will deduce the height of the AVL tree from the original paper by 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~\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}. +Regarding the implementation of AVL trees, we can see them implemented in the standard library of Agda~\cite{agda}, OCaml~\cite{ocaml} or Coq~\footnote{They also admit to follow the OCaml implementation.}~\cite{coq}. \section {B-tree} @@ -67,6 +67,6 @@ B-tree is a self-balancing tree as described by \textit{Bayer and McCreight}~\ci We have chosen the rules from \textit{Introduction to Algorithms}~\cite{cormen2009introduction} because the terminology is more familiar and compact than the rules given in the original paper by \textit{Bayer and McCreight}~\cite{btree}, where they introduce B-trees for the organization of files in filesystems, as the title suggests. Based on the original paper~\cite{btree} and \textit{Introduction to Algorithms}~\cite{cormen2009introduction}, we have deduced the following height boundaries: -\[ 1 + \log_{t}{ \left( \frac{(t - 1)(n - 1)}{2} + 1 \right)} \leq h \leq \log_t{\frac{n + 1}{2}} \] +\[ h \leq \log_t{\frac{n + 1}{2}} \] -Even though the original paper has presented B-tree to be used in filesystems or databases, there are also cases when B-tree is used to represent sets, for example, in Rust~\footnote{\url{https://github.com/rust-lang/rust/blob/master/library/alloc/src/collections/btree/map.rs} as of commit \texttt{9805437}; $t = 6$}. +Even though the original paper has presented B-tree to be used in filesystems or databases, there are also cases when B-tree is used to represent sets, for example, in Rust~\footnote{$t = 6$}~\cite{rust}.