1 ;;; Manually constructed tests for splay trees.
3 :;;;-------------------------------------------------------------------------
4 :;;; Search and splaying.
8 =_ 2+ 4+ 6+ 8+ 10+ 12+ 14+ 16+ 18+ 20+ 22+ 24+ B D
23 V:XYLA-SPLAY SPLAY zig left child
26 V:XYLA-SPLAY SPLAY zig right child
41 V:XYLA-SPLAY SPLAY zig-zig left/left child
44 V:XYLA-SPLAY SPLAY zig-zig left/left child
45 V:XYLA-SPLAY SPLAY zig left child
48 V:XYLA-SPLAY SPLAY zig-zig right/right child
49 V:XYLA-SPLAY SPLAY zig left child
63 V:XYLA-SPLAY SPLAY zig-zag left/right child
66 V:XYLA-SPLAY SPLAY zig-zag right/left child
72 V:XYLA-SPLAY SPLAY zig-zig left/left child
73 V:XYLA-SPLAY SPLAY zig left child
76 V:XYLA-SPLAY SPLAY zig-zag right/left child
77 V:XYLA-SPLAY SPLAY zig left child
80 V:XYLA-SPLAY SPLAY zig-zig right/right child
81 V:XYLA-SPLAY SPLAY zig left child
84 V:XYLA-SPLAY SPLAY zig-zig left/left child
85 V:XYLA-SPLAY SPLAY zig right child
88 V:XYLA-SPLAY SPLAY zig-zag left/right child
89 V:XYLA-SPLAY SPLAY zig right child
93 :;; Splaying example from the paper.
118 :;; All zig-zig example from the paper.
137 :;; All zig-zag example from the paper.
157 :;; Unsuccessful search example from the paper. The same setup is used for
158 :;; some later examples, and I've modified it because I consistently use the
159 :;; leftmost node of the right tree as the joining node, rather than the
160 :;; rightmost node of the left tree.
174 :;;;-------------------------------------------------------------------------
179 =_ 2+ 4+ 6+ 8+ 10+ 12+ 14+ 16+ 18+ 20+ 22+ 24+ B D
184 V:XYLA-SPLAY SPLAY zig-zig right/right child
190 V:XYLA-SPLAY SPLAY zig-zig right/right child
191 V:XYLA-SPLAY SPLAY zig-zag right/left child
195 :;; Insertion example from the paper.
199 :;;;-------------------------------------------------------------------------
204 =_ 2+ 4+ 6+ 8+ 10+ 12+ 14+ 16+ 18+ 20+ 22+ 24+ B D
209 V:XYLA-SPLAY SPLAY zig-zig left/left child
215 V:XYLA-SPLAY SPLAY zig left child
221 V:XYLA-SPLAY SPLAY zig-zag left/right child
224 V:XYLA-SPLAY SPLAY zig-zag right/left child
228 :;; Removal example from the paper, modified for difference in join policy.
232 :;;;-------------------------------------------------------------------------
236 :;; With joining node. (Trivial!)
237 =_ #12B D ( #14-25B D V~ 13k~ D V
240 :;; Without joining node.
241 =_ #12B D ( #14-25B D V~ *k~ D V
244 :;;;-------------------------------------------------------------------------
248 :;; Initial state: right-trailing vine.
256 :;; Full path tracking.
260 :;; Empty path tracking.
265 :;; A tree with a very long left-leaning tentril in the middle.
275 :;; Iteration rebalance.
276 ( #200 Vi i V 101@ p )
280 :;; Path manoeuvre rebalance.
291 :;; Lookup rebalance.
298 :;; Removal rebalance.
303 ( #15B ( #100-300 K V~ *k~ V K )
306 :;; Set op rebalance.
307 " ( #1-20 #80-120 #480-510 #910-920 B V| |
308 V:XYLA-SPLAY UNISECT rebalance
310 " ( #1-20 #80-120 #480-510 #910-920 B V\ \
311 V:XYLA-SPLAY DIFFSECT rebalance
315 :;;;----- That's all, folks -------------------------------------------------