extractmin
Extractmin is an operation used with priority queues and heap-based data structures to remove and return the element with the smallest key. It is essential in algorithms that repeatedly select the next best element, such as Dijkstra's shortest path, Prim's minimum spanning tree, and event-driven simulations. The operation typically returns the minimum element and adjusts the queue to preserve its ordering properties.
Implementation and complexity: In a binary min-heap, extractmin removes the root, moves the last element to
Variants and semantics: Some libraries expose extractmin as delete-min or extract, returning the minimum key and
Notes: The operation is distinct from peek (or minimum), which observes the minimum without removal. Example: