Priority queue: Difference between revisions

Content added Content deleted
m (→‎{{header|Quackery}}: renamed remove as dequeue to be match task description)
m (→‎{{header|Quackery}}: better bit bashing)
Line 5,464: Line 5,464:
swap poke heap.pq put ] is heapoke ( n x --> )
swap poke heap.pq put ] is heapoke ( n x --> )


[ 1+ 2 / 1 - ] is parent ( n --> n )
[ 1+ 1 >> 1 - ] is parent ( n --> n )


[ 0 > ] is has-parent ( n --> b )
[ 0 > ] is has-parent ( n --> b )


[ 2 * 1+ ] is child ( n --> n )
[ 1 << 1+ ] is child ( n --> n )


[ child heap.pq share size < ] is has-child ( n --> b )
[ child heap.pq share size < ] is has-child ( n --> b )
Line 5,523: Line 5,523:
[ ]'[ 2 pack pq->stacks
[ ]'[ 2 pack pq->stacks
heap.pq share
heap.pq share
size 2 / times
size 1 >> times
[ i heapify.pq ]
[ i heapify.pq ]
stacks->pq ] is pqwith ( [ --> p )
stacks->pq ] is pqwith ( [ --> p )