Next: , Previous: , Up: bst bnodes   [Index]


41.2.3 Structure predicates for binary nodes

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.

Function: binary-node-parent-and-left-child? bnode1 bnode2
Function: $binary-node-parent-and-left-child? bnode1 bnode2

Return #t if bnode2 is the left child of bnode1; otherwise return #f.

Function: binary-node-parent-and-right-child? bnode1 bnode2
Function: $binary-node-parent-and-right-child? bnode1 bnode2

Return #t if bnode2 is the right child of bnode1; otherwise return #f.

Function: binary-node-parent-and-child? bnode1 bnode2
Function: $binary-node-parent-and-child? bnode1 bnode2

Return #t if bnode2 is the left or right child of bnode1; otherwise return #f.

Function: binary-node-root? bnode
Function: $binary-node-root? bnode

Return #t if bnode is the root of a tree (it has no parent); otherwise return #f.

Function: binary-node-leaf? bnode
Function: $binary-node-leaf? bnode

Return #t if bnode is a leaf in the a tree (it has no children); otherwise return #f.