Data structures · Heaps and priority queues

Insert: sift up

A new item goes in the one place that keeps the shape complete, and a few swaps up the tree restore the order.