package batteries

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

Install

dune-project
 Dependency

Authors

Maintainers

Sources

batteries-3.10.0.tar.gz
md5=b7f3b99f12f21b1da6b6aa13d993206d
sha512=8b7f2479eb0271bcfd9168887c1e4a9a815c512eab3ee61b150fc4dfa9ec803e4f73115155f20b3017e4a822148d0e6d1c1e8e5f96790fd691b419dd39a908a2

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