package batteries

  1. Overview
  2. Docs
A community-maintained standard library extension

Install

Dune Dependency

Authors

Maintainers

Sources

v3.5.0.tar.gz
md5=e4b70d1a716f0aaba36f419f618d0a2e
sha512=a31f1f8cf2c7c3c6c757f3bfae98ff61bb32bab6a1f1e215937df42bcfa447aad41a37edb28d7bcecb88b3838ed8bd57142bcf8e2d28e09bb538055fd8a3b72d

doc/batteries.unthreaded/BatAvlTree/index.html

Module BatAvlTree

Internals of ISet and IMap, usable as generic tree library

type +'a tree
val empty : 'a tree
val is_empty : 'a tree -> bool
val make_tree : 'a tree -> 'a -> 'a tree -> 'a tree
val create : 'a tree -> 'a -> 'a tree -> 'a tree

create l v r is similar to make_tree l v r but performs no rebalancing; in other words, you should use this only when you know that l and r are already balanced.

val height : 'a tree -> int
val left_branch : 'a tree -> 'a tree
val right_branch : 'a tree -> 'a tree
val root : 'a tree -> 'a
val singleton_tree : 'a -> 'a tree
val split_leftmost : 'a tree -> 'a * 'a tree
val split_rightmost : 'a tree -> 'a * 'a tree
val concat : 'a tree -> 'a tree -> 'a tree
val iter : ('a -> unit) -> 'a tree -> unit
val fold : ('a -> 'b -> 'b) -> 'a tree -> 'b -> 'b
val enum : 'a tree -> 'a BatEnum.t
val check : 'a tree -> bool

Check that the tree is balanced according to the AVL tree rules. An AVL tree is balanced when for every node the height of the subnodes differs by at most 1.

  • since 2.3.0
OCaml

Innovation. Community. Security.