DataStructures.jl icon indicating copy to clipboard operation
DataStructures.jl copied to clipboard

Clarify priority in PriorityQueue

Open dpsanders opened this issue 4 years ago • 3 comments

Is the element with the largest or smallest priority first in the queue?

dpsanders avatar Nov 04 '20 22:11 dpsanders

It seems to be the smallest priority:

julia> p = PriorityQueue(["a" => 5, "b" => 10, "c" => 15]);

julia> dequeue_pair!(p)
"a" => 5

dpsanders avatar Nov 04 '20 22:11 dpsanders

It depends on the ordering direction (Forward or Reverse). The default is Forward, meaning the lowest value has the highest priority.

hdavid16 avatar Apr 28 '23 05:04 hdavid16

!close

This can be closed as the documentation (now) clearly states that default ordering is min (Forward).

i9e1 avatar Aug 10 '23 20:08 i9e1