From 1a3738e13819ea56c7a8cb70d8fb1a5ddf49b7c0 Mon Sep 17 00:00:00 2001 From: Larry Liu Date: Thu, 13 Nov 2014 09:33:39 +0200 Subject: [PATCH] [RBT] Removed some non-ASCII letters --- datastruct/tree/red-black-tree/rbtree-en.tex | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/datastruct/tree/red-black-tree/rbtree-en.tex b/datastruct/tree/red-black-tree/rbtree-en.tex index 847efb23f6..1b720918f1 100644 --- a/datastruct/tree/red-black-tree/rbtree-en.tex +++ b/datastruct/tree/red-black-tree/rbtree-en.tex @@ -194,14 +194,14 @@ \subsection{Tree rotation} \begin{algorithmic}[1] \Function{Left-Rotate}{$T, x$} \State $p \gets$ \Call{Parent}{$x$} - \State $y \gets$ \Call{Right}{$x$} \Comment{Assume $y \ne NIL$} + \State $y \gets$ \Call{Right}{$x$} \Comment{Assume $y \ne$ NIL} \State $a \gets$ \Call{Left}{$x$} \State $b \gets$ \Call{Left}{$y$} \State $c \gets$ \Call{Right}{$y$} \State \Call{Replace}{$x, y$} \State \Call{Set-Children}{$x, a, b$} \State \Call{Set-Children}{$y, x, c$} - \If{$p = NIL$} + \If{$p = $ NIL} \State $T \gets y$ \EndIf \State \Return $T$ @@ -211,14 +211,14 @@ \subsection{Tree rotation} \Function{Right-Rotate}{$T, y$} \State $p \gets$ \Call{Parent}{$y$} - \State $x \gets$ \Call{Left}{$y$} \Comment{Assume $x \ne NIL$} + \State $x \gets$ \Call{Left}{$y$} \Comment{Assume $x \ne$ NIL} \State $a \gets$ \Call{Left}{$x$} \State $b \gets$ \Call{Right}{$x$} \State $c \gets$ \Call{Right}{$y$} \State \Call{Replace}{$y, x$} \State \Call{Set-Children}{$y, b, c$} \State \Call{Set-Children}{$x, a, y$} - \If{$p = NIL$} + \If{$p = $ NIL} \State $T \gets x$ \EndIf \State \Return $T$ @@ -228,7 +228,7 @@ \subsection{Tree rotation} \Function{Set-Left}{$x, y$} \State \Call{Left}{$x$} $\gets y$ - \If{$y \ne NIL$} + \If{$y \ne$ NIL} \Call{Parent}{$y$} $\gets x$ \EndIf \EndFunction @@ -237,7 +237,7 @@ \subsection{Tree rotation} \Function{Set-Right}{$x, y$} \State \Call{Right}{$x$} $\gets y$ - \If{$y \ne NIL$} + \If{$y \ne$ NIL} \Call{Parent}{$y$} $\gets x$ \EndIf \EndFunction @@ -252,16 +252,16 @@ \subsection{Tree rotation} \Statex \Function{Replace}{$x, y$} - \If{\Call{Parent}{$x$} $= NIL$} - \If{$y \ne NIL$} - \Call{Parent}{$y$} $\gets NIL$ + \If{\Call{Parent}{$x$} = NIL} + \If{$y \ne$ NIL} + \Call{Parent}{$y$} $\gets$ NIL \EndIf \ElsIf{\textproc{Left}(\Call{Parent}{$x$}) $= x$} \State \textproc{Set-Left}(\Call{Parent}{$x$}, $y$) \Else \State \textproc{Set-Right}(\Call{Parent}{$x$}, $y$) \EndIf - \State \Call{Parent}{$x$} $\gets NIL$ + \State \Call{Parent}{$x$} $\gets$ NIL \EndFunction \end{algorithmic} @@ -417,7 +417,7 @@ \section{Insertion} \end{figure} Note that this transformation will move the redness one level up. -So this is a bottom-up recursive fixing, the last step will make +During the bottom-up recursive fixing, the last step will make the root node red. According to property 2, root is always black. Thus we need final fixing to revert the root color to black. @@ -894,11 +894,11 @@ \section{Deletion} where $p 3.1$ and $p 3.2$ are two patterns as the following. \[ -p 3.1 £º \{ color(T) = \mathcal{B} \land color(T_l) = \mathcal{B}^2 \land color(T_r) = \mathcal{R} \} +p 3.1 : \{ color(T) = \mathcal{B} \land color(T_l) = \mathcal{B}^2 \land color(T_r) = \mathcal{R} \} \] \[ -p 3.2 £º \{ color(T) = \mathcal{B} \land color(T_l) = \mathcal{R} \land color(T_r) = \mathcal{B}^2 \} +p 3.2 : \{ color(T) = \mathcal{B} \land color(T_l) = \mathcal{R} \land color(T_r) = \mathcal{B}^2 \} \] @@ -1134,7 +1134,7 @@ \section{More words} Red-black tree is the most popular implementation of balanced binary search tree. Another one is the AVL tree, which we'll introduce in next chapter. Red-black tree can be a good start point for more data structures. If we -extend the number of children from 2 to $K$, and keep the balance as well, +extend the number of children from 2 to $k$, and keep the balance as well, it leads to B-tree, If we store the data along with edge but not inside node, it leads to Tries. However, the multiple cases handling and the long program tends to make new comers think red-black tree is complex.