Page
Library
Module
Module type
Parameter
Class
Class type
Source
Binary_heap.MakeSourceType of priority queues.
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.
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)$
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