package grenier
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=658e1ad6fc5fdce0871975b3ebcb3ec760248be63cdb9ea965e3121cc7478d77
sha512=d9ff83f1b025f34c22af5921444993df219761dcee8d8cb5a940f266df8677278967434b22314c5c82d5d983e4c94c04cd52c4717d5c1f22fbd3a022631fae1c
doc/grenier.baltree/Mbt/Make/index.html
Module Mbt.Make
Source
Parameters
Signature
type +'a t = private
| Leaf
| Node of int * 'a t * 'a M.measurable * 'a t * M.measure
(*Node(size, l, x, r)
where:size
is the number of elements in the tree,l
is the left sub-treex
is a user-defined valuer
is the right sub-tree.
Trees are guaranteed balanced by construction, the depth of all branches is O(log
*)size
).
Type of balanced trees
Smart Node constructor, ensuring that the resulting tree is balanced and has the appropriate size.
Cost of node l x r
is expected to be O(log |size l
- size r
|) amortized, i.e proportional to the logarithm of the disbalance. In particular, if l
and r
are similarly-sized, it operates in constant time on average. NOT PROVEN
User-values can be moved in different subtrees of the result, but the ordering is preserved (so data stay correct if the operation applied on values is associative or the relation expected between them is transitive).
Convenience functions
Concatenate two trees. Cost of join l r
is O(log (min size l
size r
)). NOT PROVEN
Return the n'th node in tree order