Pixel Priority Arena
A new game has three bugs, but the worst crash must be fixed first! Build a priority heap that always lifts the most urgent ticket to the top.
๐ง Before we start
At the backstage door, your token bucket made waiting work take turns safely. Today, turns are not enough: a priority queue uses a heap so the strongest priority always bubbles to the top.
Arrange the priority recipe
Tap four visual instruction blocks in the order a max-heap uses when a new bug ticket arrives.
Build the bug heap
Add the glowing ticket in arrival order. Then tap the urgent crash and its parent to bubble priority 3 to the top.
Dispatch the most urgent bug
Tap the top ticket to fix it. The heap moves its last ticket to the top and repairs the order, so the next strongest bug is ready.
Debug a changed priority
The tiny paint bug became a giant screen-flash bug. Its priority changed from 1 to 4 while it was below a priority-2 parent. Repair the heap.
๐ What you learned
- A priority queue serves the most urgent item before less urgent work.
- A max-heap keeps its strongest item at the top.
- New items fill the next open spot so the heap stays compact.
- A stronger child swaps upward until its parent is strong enough.
- When a priority changes, the heap must rebalance to restore its rule.