BinaryHeap
public struct BinaryHeap<Element, Value> where Element : Hashable, Value : Comparable
Implements a priority queue where minimum values have highest priority.
-
Create an empty
BinaryHeap.Declaration
Swift
public init() -
Create a
BinaryHeapwith the givensequence.Declaration
Swift
public init<S>(_ sequence: S) where S : Sequence, S.Element == (Element, Value)
-
Insert element into
BinaryHeapinstance with associated valuevalue.Declaration
Swift
public mutating func insert(_ element: Element, _ value: Value) -
Declaration
Swift
public mutating func pop() -> (Element, Value)?Return Value
Minimum value element of
BinaryHeapinstance ornilif empty.
View on GitHub
Install in Dash
BinaryHeap Structure Reference