Join Nostr
2024-09-28 21:08:39 UTC
in reply to

alcinnz on Nostr: Dequeueing an entry involves removing the 1st/root entry to return by replacing it ...

Dequeueing an entry involves removing the 1st/root entry to return by replacing it with the last entry. Then we repeatedly replace this parent with its smallest child to reestablish the min-heap invariant.

Enqueueing involves adding it to the end of the array, then swapping this child with its parent until the min-heap's invariant's reestablished.

We can store the array's length at its 0'th index. And *maybe* we'd enable our Arithmetic Core's harvard-mode for the extra storage.

3/4!