View Source CEM.RankHeap (cem v0.1.1)
Module that defines a RankHeap
as an adaptation of PairingHeap
.
The rank heap maintains a maximum number of key-value pairs with the highest or lowest keys in a stream.
Summary
Functions
Create a new rank heap.
Return the root key of the rank heap.
Update the rank heap with a new key-value pair.
Return the values in the rank heap.
Types
@type key() :: number()
@type mode() :: :low | :high
@type t() :: %CEM.RankHeap{ heap: PairingHeap.t(), max_size: pos_integer(), mode: mode(), size: non_neg_integer(), swap?: (number(), number() -> boolean()) }
@type value() :: any()
Functions
@spec new(mode :: mode(), max_size :: non_neg_integer()) :: t()
Create a new rank heap.
Return the root key of the rank heap.
Update the rank heap with a new key-value pair.
Return the values in the rank heap.