Module Heap.MakeRanked

Parameters

module Rank : RankedType

Signature

type elt = Rank.t

The type of elements of the heap.

type t

The type of heaps.

val create : int -> elt -> t

Create a heap with the given initial size and dummy element.

val in_heap : elt -> bool

Heap membership function.

val decrease : t -> elt -> unit

Decrease activity of the given element.

val increase : t -> elt -> unit

Increase activity of the given element.

val size : t -> int

Returns the current size of the heap.

val is_empty : t -> bool

Is the heap empty ?

val insert : t -> elt -> unit

Insert a new element in the heap.

val grow_to_by_double : t -> int -> unit

Grow the size of the heap by multiplying it by 2 until it is at least the size specified.

val pop_min : t -> elt

Remove the minimum element from the heap and return it.

  • raises Not_found

    if the heap is empty.

val filter : t -> (elt -> bool) -> unit

Filter elements in the heap.