Jump to content

Min-max heap

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Templatetypedef (talk | contribs) at 05:13, 5 January 2011 (Created article.). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)

A min-max heap is a double-ended priority queue implemented as a modified version of a binary heap. Like a binary heap, a min-max heap is represented as a complete binary tree. Unlike a binary heap, though, the nodes in this tree do not obey the min-heap property; rather they obey the min-max heap property. Each node at an even level in the tree is less than all of its descendants, while each node at an odd level in the tree is greater than all of its descendants.

Like binary heaps, min-max heaps support O(lg n) insertion and deletion, can be built in time O(n), and are often represented implicitly in an array.

References

Atkinson et al. Min-Max Heaps and Generalized Priority Queues.