Priority queue: Difference between revisions

m
Line 6,977:
if size>ubound(q) then redim preserve q(ubound(q)*1.1)
q(size)=x
if size=1 then q(0)=x 'ugly!!
sift_up
end sub
Line 6,990 ⟶ 6,989:
h=size
p=h\2
if sizep=10 then q(0)=x exit 'ugly!!sub
while out_of_order(q(p),q(h)) and h>1
swap h,p
h=p
p=h\2
if p=0 then exit sub
wend
end sub
end sub
Line 7,058 ⟶ 7,060:
5 Make tea
</pre>
 
=={{header|Wren}}==
{{libheader|Wren-queue}}