| cs-llrb - Chez Scheme implementation of left-leaning red-black trees.
git clone https://benconnors.ca/git-repos/cs-llrb |
A basic implementation of a left-leaning red-black tree for Chez Scheme.
(make-tree cmp)
Create a new tree using the comparison function (cmp a b), which returns a negative number if a < b, zero if a = b, and a positive number if a > b (or vice-versa).
(tree-insert! t key value)
Insert value at key in tree t. This will replace an existing node or create a new one if the key doesn't exist. Returns t.
(tree-delete! t key)
Delete the value at key in tree t. Returns #t if key was present and #f otherwise.
(tree-search t key)
Search the tree t for key and return its value; if not found, raises not-found.
(tree-get t key not-found)
Search the tree t for key and return its value; if not found, returns not-found.
(tree-has? t key)
Check if the tree t has key.