Neo & Byte · #5 · Min-heap
A min-heap keeps the smallest value on top, so reading it takes O(1), and inserting a value or taking out the smallest one takes O(log n). Each value is only smaller than its own children, so nothing tells you where any other value is: finding it means checking the values one by one, O(n). Here box 7 sat in the very last spot.
In the VisiGrab app, build a min-heap yourself: insert, take the minimum, and watch every swap. App Store · Google Play