Clarify explanations in Background section

This commit is contained in:
Jack Grigg 2020-03-04 18:11:26 +13:00 committed by Daira Hopwood
parent bf159d1221
commit f503789adf
1 changed files with 8 additions and 5 deletions

View File

@ -76,7 +76,7 @@ This leaves us with three subtrees ("mountains") of altitudes 3, 1, and 0:
/\/\/\/\ /\ /
Note that the first leftmost peak is always the highest. We can number this structure in
order of insertion:
the order by which nodes would be created, if the leaves were inserted from left to right:
.. code-block:: C
@ -107,16 +107,19 @@ find the subtree roots ("peaks") of the mountains.
Once we have the positions of the mountain peaks, we "bag" them using the following
algorithm:
1. add a peak connecting the 2 left-most peaks
2. repeat 1. until we have a single peak
1. Generate a node connecting the 2 left-most peaks, forming a new peak
2. Repeat 1. until we have a single peak
Note that the extra nodes generated during the bagging process do not follow the above
rules for jumping between nodes.
.. code-block:: C
Altitude
5 20
5 20g
/ \
4 19 \
4 19g \
/ \ \
/ \ \
/ \ \