Join Nostr
2024-09-28 20:51:51 UTC
in reply to

alcinnz on Nostr: We'd use a min-heap for a priority-queue, stored in our Arithmetic Core! A min-heap ...

We'd use a min-heap for a priority-queue, stored in our Arithmetic Core!

A min-heap is a balanced binary-tree where we enforce the invariant that parents hold smaller values than their children.
Storing this binary tree "implicitly" in an array, such that the children of node x are at 2x & 2x+1 is space efficient, & fast at adding or removing an item at the end of the array.

Lets say here each entry holds 4 16bit words: A priority & a bit-packed zone ID. Or maybe we could get by with 2.

2/3?