Module Heap.Functional
Parameters
Signature
type elt
= X.t
Type of elements
val empty : t
The empty heap
val add : elt -> t -> t
add x h
returns a new heap containing the elements ofh
, plusx
; complexity$
O(log(n))$
val maximum : t -> elt
maximum h
returns the maximum element ofh
; raisesEmptyHeap
whenh
is empty; complexity$
O(1)$
val remove : t -> t
remove h
returns a new heap containing the elements ofh
, except the maximum ofh
; raisesEmptyHeap
whenh
is empty; complexity$
O(log(n))$