Next: , Up: bst bnodes   [Index]


41.2.1 Binary node data type

The following syntactic bindings are exported by the library (vicare containers binary-search-trees).

R6RS Record Type: <binary-node>

Record type representing a node in a binary tree. The <binary-node> type is non–generative and available for subtyping. In this documentation <binary-node> object arguments to functions are indicated as bnode.

This type has the following fields:

parent

An instance of <binary-node> representing the parent node; #f if this node has no parent.

left

An instance of <binary-node> representing the left child, the root of the left subtree; #f if this node has no left subtree.

right

An instance of <binary-node> representing the right child, the root of the right subtree; #f if this node has no right subtree.

Function: make-binary-node
Function: make-binary-node left right

Build and return a new instance of <binary-node>. The optional left and right arguments must be #f or instances of <binary-node> representing the left and right subtrees. The parent field of the new instance is set to #f.

Function: binary-node? obj

Return #t if obj is an instance of <binary-node>; otherwise return #f.