Heapsort underlies priority-queue ordering but is not stable: items with equal priorities are not guaranteed to retain insertion order. section 12.2
Preserving insertion order
Equal-priority work items may be processed in reverse insertion order. Add an order field to each item and compare it after priority to preserve insertion order. section 12.2
Figure 12.1 On the left, a binary tree that satisfies the heap property; on the right, a binary search tree that does not satisfy the heap property
Compare the heap property with a binary search tree to see the structure supporting priority ordering. section 12.2
