package owl-base
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=3817a2e4391922c8a2225b4e33ca95da6809246994e6bf291a300c82d8cac6c5
sha512=68a21f540cb4a289419f35cd152d132af36f1000fb41f98bab6e100698820379e36d650c5aa70a0126513451b354f86a28ea4ecf6f1d3b196b5b5e56f0fac9bd
doc/owl-base/Owl_utils_heap/index.html
Module Owl_utils_heapSource
Type definition
Type of a min heap.
Basic functions
make cmp creates an empty min heap, using cmp as a comparison function.
make_int ?initial_size cmp creates an empty integer heap, using cmp as a comparison function and pre-allocates a space of initial_size elements.
make_float ?initial_size cmp creates an empty float heap, using cmp as a comparison function and pre-allocates a space of initial_size elements.
push heap x pushes x into heap. Time complexity is O(log(n)), where n is the size of heap.
pop heap pops the minimal element from heap. It raises an exception if the heap is empty. Time complexity is O(log(n)), where n is the size of heap.
peek heap returns the value of the minimal element in heap but it does not remove the element from the heap. Raises an exception if the heap is empty. Time complexity is O(1).