Skip to content

Commit ce1dbe4

Browse files
committed
Update docs
1 parent d987bff commit ce1dbe4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/src/priority-queue.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@ Usage:
1414
```julia
1515
PriorityQueue{K, V}() # construct a new priority queue with keys of type K and priorities of type V (forward ordering by default)
1616
PriorityQueue{K, V}(ord) # construct a new priority queue with the given types and ordering ord (Base.Order.Forward or Base.Order.Reverse)
17-
enqueue!(pq, k, v) # insert the key k into pq with priority v
18-
enqueue!(pq, k=>v) # (same, using Pairs)
19-
dequeue!(pq) # remove and return the lowest priority key
20-
dequeue_pair!(pq) # remove and return the lowest priorty key and value
21-
peek(pq) # return the lowest priority key and value without removing it
17+
push!(pq, k=>v) # insert the key k into pq with priority v
18+
popfirst!(pq) # remove and return the lowest priority key and value
19+
first(pq) # return the lowest priority key and value without removing it
2220
delete!(pq, k) # delete the mapping for the given key in a priority queue, and return the priority queue.
2321
```
2422

@@ -28,8 +26,7 @@ inserted and priorities accessed or changed using indexing notation.
2826
Examples:
2927

3028
```jldoctest
31-
julia> # Julia code
32-
pq = PriorityQueue();
29+
julia> pq = PriorityQueue();
3330
3431
julia> # Insert keys with associated priorities
3532
pq["a"] = 10; pq["b"] = 5; pq["c"] = 15; pq
@@ -45,7 +42,9 @@ PriorityQueue{Any, Any, Base.Order.ForwardOrdering} with 3 entries:
4542
"b" => 5
4643
"c" => 15
4744
```
48-
It is also possible to iterate over the priorities and elements of the queue in sorted order.
45+
46+
It is also possible to iterate over the priorities and elements of the queue in sorted order.
47+
4948
```jldoctest
5049
julia> pq = PriorityQueue("a"=>2, "b"=>1, "c"=>3)
5150
PriorityQueue{String, Int64, Base.Order.ForwardOrdering} with 3 entries:
@@ -67,6 +66,7 @@ b
6766
a
6867
c
6968
```
69+
7070
```@meta
7171
DocTestSetup = nothing
7272
```

0 commit comments

Comments
 (0)