Jump to content

Priority queue: Difference between revisions

m
Line 4,681:
 
<syntaxhighlight lang="m2000 interpreter">
// using pointers to objects
global countmany=0&
class obj {
Line 4,722 ⟶ 4,721:
Header()
while not @isEmpty(b)
//Print @Pop(b)=>tostring$
checkme(@Pop(b))
end while
ObjectCount()
Line 4,741:
push n
local t=2, b=len(a)
local m=b
while t<=b
t1=m
m=(b+t) div 2
Line 4,763:
end function
Function Pop(a)
// Group make a copy, but here is a pointer, we get a new pointer
// also drop the pointer from the top of stack
stack a {=Group}
end function
sub checkme(a as *obj)
Print a=>tostring$
end sub
}
PriorityQueueForGroups
404

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.