Import std.collections.priority_queue
PriorityQueue
std.collections.priority_queue
class
@DebugElements Public Class PriorityQueue<T> Implements Iterable<T>, Cloneable
A heap that gives its values out first by a priority: the smallest first, or what a Function says comes first.
Examples
Local smallest = PriorityQueue<Int>()
smallest.AddAll([5, 1, 4])
Expect(smallest.Pop() == 1)
Expect(smallest.Peek() == 4)
Local largest = PriorityQueue<Int>(Function(a: Int, b: Int) => a > b)
largest.AddAll([5, 1, 4])
Expect(largest.Drain() == [5, 4, 1])std/collections/priority_queue.fb, line 25
-
A new, empty PriorityQueue that gives its smallest value first.
-
A new, empty PriorityQueue that gives first the value
beforesays comes before the others. -
How many values it holds.
-
Puts
valuein. -
Adds each of the
values, putting the heap in order once, in time that grows with the count. -
Takes the first value off and gives it. Panics when the PriorityQueue is empty.
-
Takes the first value off and gives it, or Null when the PriorityQueue is empty.
-
The first value, which stays, or Null when the PriorityQueue is empty.
-
Takes every value off, and gives them in the order Pop would.
-
The values, in no particular order, in a new array.
-
The first value, which stays. Panics when the PriorityQueue is empty.
-
Whether it holds
value. -
Takes every value out.
-
A new PriorityQueue with the same values and order.
-
The values, in no particular order: Pop gives them in order. Changing the PriorityQueue while going over them panics.
Report an issue with this page or with FutureBlitz on GitHub.