Use 0-based array indexing
This commit is contained in:
parent
a456fedeff
commit
ee7ede62d5
|
@ -774,21 +774,21 @@ The following array corresponds to the above tree:
|
|||
\node at (14.5,0.5) {$1$};
|
||||
|
||||
\footnotesize
|
||||
\node at (0.5,2.5) {$1$};
|
||||
\node at (1.5,2.5) {$2$};
|
||||
\node at (2.5,2.5) {$3$};
|
||||
\node at (3.5,2.5) {$4$};
|
||||
\node at (4.5,2.5) {$5$};
|
||||
\node at (5.5,2.5) {$6$};
|
||||
\node at (6.5,2.5) {$7$};
|
||||
\node at (7.5,2.5) {$8$};
|
||||
\node at (8.5,2.5) {$9$};
|
||||
\node at (9.5,2.5) {$10$};
|
||||
\node at (10.5,2.5) {$11$};
|
||||
\node at (11.5,2.5) {$12$};
|
||||
\node at (12.5,2.5) {$13$};
|
||||
\node at (13.5,2.5) {$14$};
|
||||
\node at (14.5,2.5) {$15$};
|
||||
\node at (0.5,2.5) {$0$};
|
||||
\node at (1.5,2.5) {$1$};
|
||||
\node at (2.5,2.5) {$2$};
|
||||
\node at (3.5,2.5) {$3$};
|
||||
\node at (4.5,2.5) {$4$};
|
||||
\node at (5.5,2.5) {$5$};
|
||||
\node at (6.5,2.5) {$6$};
|
||||
\node at (7.5,2.5) {$7$};
|
||||
\node at (8.5,2.5) {$8$};
|
||||
\node at (9.5,2.5) {$9$};
|
||||
\node at (10.5,2.5) {$10$};
|
||||
\node at (11.5,2.5) {$11$};
|
||||
\node at (12.5,2.5) {$12$};
|
||||
\node at (13.5,2.5) {$13$};
|
||||
\node at (14.5,2.5) {$14$};
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
|
@ -846,27 +846,27 @@ can be found as follows:
|
|||
\node at (14.5,0.5) {$1$};
|
||||
|
||||
\footnotesize
|
||||
\node at (0.5,2.5) {$1$};
|
||||
\node at (1.5,2.5) {$2$};
|
||||
\node at (2.5,2.5) {$3$};
|
||||
\node at (3.5,2.5) {$4$};
|
||||
\node at (4.5,2.5) {$5$};
|
||||
\node at (5.5,2.5) {$6$};
|
||||
\node at (6.5,2.5) {$7$};
|
||||
\node at (7.5,2.5) {$8$};
|
||||
\node at (8.5,2.5) {$9$};
|
||||
\node at (9.5,2.5) {$10$};
|
||||
\node at (10.5,2.5) {$11$};
|
||||
\node at (11.5,2.5) {$12$};
|
||||
\node at (12.5,2.5) {$13$};
|
||||
\node at (13.5,2.5) {$14$};
|
||||
\node at (14.5,2.5) {$15$};
|
||||
\node at (0.5,2.5) {$0$};
|
||||
\node at (1.5,2.5) {$1$};
|
||||
\node at (2.5,2.5) {$2$};
|
||||
\node at (3.5,2.5) {$3$};
|
||||
\node at (4.5,2.5) {$4$};
|
||||
\node at (5.5,2.5) {$5$};
|
||||
\node at (6.5,2.5) {$6$};
|
||||
\node at (7.5,2.5) {$7$};
|
||||
\node at (8.5,2.5) {$8$};
|
||||
\node at (9.5,2.5) {$9$};
|
||||
\node at (10.5,2.5) {$10$};
|
||||
\node at (11.5,2.5) {$11$};
|
||||
\node at (12.5,2.5) {$12$};
|
||||
\node at (13.5,2.5) {$13$};
|
||||
\node at (14.5,2.5) {$14$};
|
||||
\end{tikzpicture}
|
||||
\end{center}
|
||||
|
||||
Node 5 is at position 3, node 8 is at position 6,
|
||||
Node 5 is at position 2, node 8 is at position 5,
|
||||
and the node with lowest level between
|
||||
positions $3 \ldots 6$ is node 2 at position 4
|
||||
positions $2 \ldots 5$ is node 2 at position 3
|
||||
whose level is 2.
|
||||
Thus, the lowest common ancestor of
|
||||
nodes 5 and 8 is node 2.
|
||||
|
|
Loading…
Reference in New Issue