Next: bst bnodes pred, Previous: bst bnodes objects, Up: bst bnodes [Index]
The following syntactic bindings are exported by the library
(vicare containers binary-search-trees)
. The bindings whose name is
prefixed with $
are unsafe operations: they do not
validate their arguments before accessing them.
Accessor for the parent node of bnode. Return #f
or an
instance of <binary-node>
.
Accessor for the left subtree of bnode. Return #f
or an
instance of <binary-node>
.
Mutator for the left subtree of a <binary-node>
instance. The
argument left must be #f
or an instance of
<binary-node>
representing the root of the left subtree. When
left is a node: it is mutated to reference bnode as parent.
Accessor for the right subtree of bnode. Return #f
or an
instance of <binary-node>
.
Mutator for the right subtree of a <binary-node>
instance.
The argument right must be #f
or an instance of
<binary-node>
representing the root of the right subtree.
When right is a node: it is mutated to reference bnode as
parent.
Replace one child node with another child node.
The argument old-child must be an instance of
<binary-node>
; the argument new-child must be #f
or an instance of <binary-node>
.
Let’s name dad the parent of old-child, dad can be
#f
or an instance of <binary-node>
; this function
performs the following operations:
#f
.
As example, let’s consider this simple tree:
2--3 0 | 1
applying this function to old-child having key ‘1’ and new-child having key ‘0’, results in the following tree:
2--3 1 | 0
Next: bst bnodes pred, Previous: bst bnodes objects, Up: bst bnodes [Index]