package grenier
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=271ae9461d012c99449e5233386b13ab99ae2e474ed570e05bf0c9947e5eff1e
sha512=73c89aa6281f612c499eb734c6fc4d33b961ed82d6cc7380b03acb196233c27107e103b11f55e50f543f0f1dedb4924e6691a5c3c353ef4d8177bc661fc2bfd4
doc/grenier.baltree/Mbt/Make/index.html
Module Mbt.Make
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:sizeis the number of elements in the tree,lis the left sub-treexis a user-defined valueris the right sub-tree.
Trees are guaranteed balanced by construction, the depth of all branches is O(log
*)size).
Type of balanced trees
val leaf : 'a tLeaf constructor, the empty tree
val node : 'a t -> 'a M.measurable -> 'a t -> 'a tSmart 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
val size : 'a t -> intAccessor to the size
Concatenate two trees. Cost of join l r is O(log (min size l size r)). NOT PROVEN
val rank : int -> 'a t -> 'a M.measurableReturn the n'th node in tree order