package batteries

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

Install

Dune Dependency

Authors

Maintainers

Sources

v3.7.1.tar.gz
md5=d02c4f044e53edca010de46f9139ce00
sha512=99a5afa3604c4cf0c849c670111d617f7f255acb0da043b73ddffdf0e299948bce52516ee31921f269de6088156c4e0a187e0b931543c6819c6b25966b303281

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
OCaml

Innovation. Community. Security.