Encyclopedia > Heap

  Article Content


In computer science a heap is a specialized tree-based data structure. Its base datatype (used for node keys) must be an ordered set.

Let A and B be nodes of a heap, such that B is a child of A. The heap must then satisfy the following condition (heap property):

key(A) ≥ key(B)

This is the only restriction of general heaps. It implies that the greatest (or the smallest, depending on the semantics of a comparison) element is always in root node. Due to this fact, heaps are used to implement priority queues. The efficiency of heap operations is crucial in several graph algorithms.

Heaps are used in the sorting algorithm called heapsort.

Common variants include:

External links

All Wikipedia text is available under the terms of the GNU Free Documentation License

  Search Encyclopedia

Search over one million articles, find something about almost anything!
  Featured Article
Sanskrit language

... in the middle of the second millennium BC. The Vedic form survived until the middle of the first millennium BC. Around this time, as Sanskrit made the transition ...

This page was created in 52.7 ms