Library
Module
Module type
Parameter
Class
Class type
create ~dummy c
creates a new heap, with initial capacity of c
. The value dummy
is used to fill unused cells of the internal array. Note: dummy
can still be used as a regular value in the queue.
val length : t -> int
length h
returns the number of elements of h
val is_empty : t -> bool
is_empty h
checks the emptiness of h
add x h
adds a new element x
in heap h
; size of h
is doubled when maximum capacity is reached; complexity $O(log(n))$
minimum h
returns the minimum element of h
; raises Empty
when h
is empty; complexity $O(1)$
val remove : t -> unit
remove h
removes the minimum element of h
; raises Empty
when h
is empty; complexity $O(log(n))$
pop_minimum h
removes the minimum element of h
and returns it; raises Empty
when h
is empty; complexity $O(log(n))$
usual iterators and combinators; elements are presented in arbitrary order