The Heap Structure and Its Applications

Main Article Content

C. R. Kavitha

Abstract

A heap is a partially sorted binary tree. Like the binary trees, heaps have a meaning for the Left and Right subtrees. The root of a heap is guaranteed to hold the largest node in the trees; its subtrees contain data that have lesser values. Unlike the binary search tree, however, the smaller nodes of a heap can be placed on either the Right or Left subtree. Therefore, both the Left and Right branches of the tree have the same meaning .Heaps have another interesting facet: They are often implemented in an array rather than a linked list. This implementation is possible because the heap is, by definition, complete or nearly complete. This allows a fixed relationship between each node and its children. There are two factors at work: the time it takes to create a heap by adding each element and the time it takes to remove all of the elements from a heap. Fortunately, we have a guarantee that adding a single element to and removing a single element from a heap both take O(log(n)) time.

Keywords: Heap, Reheapup, Reheapdown, Maxheap, Minheap

Downloads

Download data is not yet available.

Article Details

Section
Articles