The binary tree is sometimes an efficient way to store data. When a
binary tree is created a compare function is given to the create
function (bintree-create
). This function is used throughout
all data entry and deletions into and out of the tree.
To use the binary tree in Elib you must put the line
(require 'bintree)
in your elisp source file.
The following functions are provided by the binary tree in the library:
(bintree-create compare-function)
(compare-function data1 data2)
should return non-nil
if data1
is less than data2
,
and nil
otherwise.
(bintree-p tree)
t
if tree is an bintree, otherwise return nil
.
(bintree-compare-function tree)
compare-function
given to bintree-create
when
tree was created.
(bintree-empty tree)
t
if tree is empty, otherwise return nil
.
(bintree-enter tree data)
compare-function
given
to bintree-create
, the new element will replace the old one in
the tree.
(bintree-delete tree data)
compare-function
given to bintree-create
. If there
is no matching element within the tree, nothing is done to the tree.
(bintree-member tree data)
compare-function
given to bintree-create
. If there
is no such element in the tree, return nil
.
(bintree-map map-function tree)
(bintree-first tree)
compare-function
given to bintree-create
. If the
tree is empty, return nil
.
(bintree-last tree)
compare-function
given to bintree-create
. If the
tree is empty, return nil
.
(bintree-copy tree)
(bintree-flatten tree)
(bintree-size tree)
(bintree-clear tree)
Go to the first, previous, next, last section, table of contents.