package batteries

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

batteries-3.11.0.tar.gz
md5=096be9e83e347b4c7b5b6e5b2af22992
sha512=621dca842c4a7adf0ac1e907bf44c1405e0b66a088987a138a4f4e98ca744815913bf87fd780619151cb049a07d7fdb1e8adb7b65698ab46b8c2dfe46cd7119d

doc/batteries.unthreaded/BatAvlTree/index.html

Module BatAvlTreeSource

Internals of ISet and IMap, usable as generic tree library

Sourcetype +'a tree
Sourceval empty : 'a tree
Sourceval is_empty : 'a tree -> bool
Sourceval make_tree : 'a tree -> 'a -> 'a tree -> 'a tree
Sourceval 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.

Sourceval height : 'a tree -> int
Sourceval left_branch : 'a tree -> 'a tree
Sourceval right_branch : 'a tree -> 'a tree
Sourceval root : 'a tree -> 'a
Sourceval singleton_tree : 'a -> 'a tree
Sourceval split_leftmost : 'a tree -> 'a * 'a tree
Sourceval split_rightmost : 'a tree -> 'a * 'a tree
Sourceval concat : 'a tree -> 'a tree -> 'a tree
Sourceval iter : ('a -> unit) -> 'a tree -> unit
Sourceval fold : ('a -> 'b -> 'b) -> 'a tree -> 'b -> 'b
Sourceval enum : 'a tree -> 'a BatEnum.t
Sourceval 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