Fix for heap_pop() test in arrays

This commit is contained in:
Bruce Hill 2024-12-31 16:23:16 -05:00
parent 8df0cc41c9
commit 2fcf1939bb

View File

@ -105,16 +105,16 @@ func main():
>> heap:heapify() >> heap:heapify()
>> heap >> heap
sorted := @[:Int] sorted := @[:Int]
while heap.length > 0: repeat:
sorted:insert(heap:heap_pop()) sorted:insert(heap:heap_pop() or stop)
>> sorted == sorted:sorted() >> sorted == sorted:sorted()
= yes = yes
for _ in 10: for _ in 10:
heap:heap_push(random:int(1, 50)) heap:heap_push(random:int(1, 50))
>> heap >> heap
sorted = @[:Int] sorted = @[:Int]
while heap.length > 0: repeat:
sorted:insert(heap:heap_pop()) sorted:insert(heap:heap_pop() or stop)
>> sorted == sorted:sorted() >> sorted == sorted:sorted()
= yes = yes