package grenier
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=e5362e6ad0e888526517415e78b9e8243bb0cc1b0c952201884148832ac4442f
sha512=4e2f16b52b3c2786a1b8e93156184fd69d448cea571ca839b6cb88ab73f380994d1561fe24c1523c43ed8fc42d2ac01b673a13b6151fff4af4f009923d3aaf37
doc/grenier.baltree/Bt2/index.html
Module Bt2
Type of balanced trees with two custom values (more efficient than a pair)
val leaf : ('a, 'b) t
Leaf constructor, the empty tree
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
val size : ('a, 'b) t -> int
Accessor 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, 'b) t -> 'a * 'b
Return the n'th node in tree order