Priority queue: Difference between revisions
Content deleted Content added
Added Quackery. |
m →{{header|Quackery}}: tidy up |
||
Line 5,210:
The task [[Sorting algorithms/Heapsort#Quackery]] implements a priority queue. Here we reuse the words <code>comparison</code>, <code>toheap</code>, and <code>fromheap</code> from that task and adapt them to this task. <code>p</code> in the stack comments denotes a priority queue.
<lang Quackery>
[ ' [ 0 peek swap 0 peek > ]
comparison put [] ] is new-pq ( --> p )
[ nested join toheap ]
[ fromheap 1 peek ]
[ drop comparison release ]
new-pq
|