module MinMaxHeap:An imperative array based min-max heap data structure. Adding elements and removing the minimum and maximum element have logarithmic complexity.
See: Atkinson, Sack, Santoro, Strothotte Mix-Max Heaps and Generalized Priority Queues. Communications of the ACM 1986, October 26, Volume 29, Number 10, p.996-1000
The heap can take up to Sys.max_array_length
elements.
Parameters: |
|
typedata =
Ord.t
type
t
val create : data -> t
val add : t -> data -> unit
OVERFLOW
if the heap is full.val min : t -> data
Not_found
if the heap is empty.val max : t -> data
Not_found
if the heap is empty.val remove_min : t -> data
Not_found
if the heap is empty.val remove_max : t -> data
Not_found
if the heap is empty.val iter : (data -> unit) -> t -> unit
val is_empty : t -> bool
val size : t -> int
val to_string : t -> string