You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The root of the hashsplit tree is $N_{h^\prime,0}$
247
+
for the smallest value of $h^\prime$
248
+
such that $|N_{h^\prime}| = 1$
249
+
250
+
### Procedural description
251
+
252
+
For this description we use $N_h$ to denote a single node at height $h$.
253
+
The algorithm must keep track of the “rightmost” such node for each tier in the tree.
254
+
255
+
To compute a hashsplit tree from a byte sequence $X$,
173
256
compute its “root node” as follows.
174
257
175
-
1. Let $N_0$ be $(0, \langle\rangle)$ (i.e., a node at depth 0 with no children).
258
+
1. Let $N_0$ be $\langle\rangle$ (i.e., a node at height 0 with no children).
176
259
2. If $|X| = 0$, then:
177
-
a. Let $d$ be the largest depth such that $N_d$ exists.
178
-
b. If $|\operatorname{Children}(N_0)| > 0$, then:
179
-
i. For each integer $i$ in $[0 .. d]$, “close” $N_i$.
180
-
ii. Set $d \leftarrow d+1$.
181
-
c. [pruning] While $d > 0$ and $|\operatorname{Children}(N_d)| = 1$, set $d \leftarrow d-1$ (i.e., traverse from the prospective tree root downward until there is a node with more than one child).
182
-
d. **Terminate** with $N_d$ as the root node.
183
-
3. Otherwise, set $N_0 \leftarrow (0, \operatorname{Children}(N_0) \mathbin{\|} \langle P(X) \rangle)$ (i.e., add $P(X)$ to the list of children in $N_0$).
184
-
4. For each integer $i$ in $[0 .. L(X))$, “close” the node $N_i$ (see below).
185
-
5. Set $X \leftarrow R(X)$.
260
+
a. Let $h$ be the largest height such that $N_h$ exists.
261
+
b. If $|N_0| > 0$, then:
262
+
i. For each integer $i$ in $[0 .. h]$, “close” $N_i$ (see below).
263
+
ii. Set $h \leftarrow h+1$.
264
+
c. [pruning] While $h > 0$ and $|N_h| = 1$, set $h \leftarrow h-1$ (i.e., traverse from the prospective tree root downward until there is a node with more than one child).
265
+
d. **Terminate** with $N_h$ as the root node.
266
+
3. Otherwise, set $N_0 \leftarrow N_0 \mathbin{\|} \langle P_C(X) \rangle$ (i.e., add $P_C(X)$ to the list of children in $N_0$).
267
+
4. For each integer $i$ in $[0 .. L_C(X))$, “close” the node $N_i$ (see below).
268
+
5. Set $X \leftarrow R_C(X)$.
186
269
6. Go to step 2.
187
270
188
271
To “close” a node $N_i$:
189
272
190
-
1. If no $N_{i+1}$ exists yet, let $N_{i+1}$ be $(i+1, \langle\rangle)$ (i.e., a node at depth ${i + 1}$ with no children).
191
-
2. Set $N_{i+1} \leftarrow (i+1, \operatorname{Children}(N_{i+1}) \mathbin{\|} \langle N_i \rangle)$ (i.e., add $N_i$ as a child to $N_{i+1}$).
192
-
3. Let $N_i$ be $(i, \langle\rangle)$ (i.e., new node at depth $i$ with no children).
273
+
1. If no $N_{i+1}$ exists yet, let $N_{i+1}$ be $\langle\rangle$ (i.e., a node at height ${i + 1}$ with no children).
274
+
2. Set $N_{i+1} \leftarrow N_{i+1} \mathbin{\|} \langle N_i \rangle$ (i.e., add $N_i$ as a child to $N_{i+1}$).
275
+
3. Let $N_i$ be $\langle\rangle$ (i.e., new node at height $i$ with no children).
0 commit comments