heap


Also found in: Dictionary, Thesaurus, Legal, Acronyms, Idioms, Wikipedia.

heap

(programming)
An area of memory used for dynamic memory allocation where blocks of memory are allocated and freed in an arbitrary order and the pattern of allocation and size of blocks is not known until run time. Typically, a program has one heap which it may use for several different purposes.

Heap is required by languages in which functions can return arbitrary data structures or functions with free variables (see closure). In C functions malloc and free provide access to the heap.

Contrast stack. See also dangling pointer.

heap

(programming)
A data structure with its elements partially ordered (sorted) such that finding either the minimum or the maximum (but not both) of the elements is computationally inexpensive (independent of the number of elements), while both adding a new item and finding each subsequent smallest/largest element can be done in O(log n) time, where n is the number of elements.

Formally, a heap is a binary tree with a key in each node, such that all the leaves of the tree are on two adjacent levels; all leaves on the lowest level occur to the left and all levels, except possibly the lowest, are filled; and the key in the root is at least as large as the keys in its children (if any), and the left and right subtrees (if they exist) are again heaps.

Note that the last condition assumes that the goal is finding the minimum quickly.

Heaps are often implemented as one-dimensional arrays. Still assuming that the goal is finding the minimum quickly the invariant is

heap[i] <= heap[2*i] and heap[i] <= heap[2*i+1] for all i,

where heap[i] denotes the i-th element, heap[1] being the first. Heaps can be used to implement priority queues or in sort algorithms.

heap

In programming, it refers to a common pool of memory that is available to the program. The management of the heap is either done by the applications themselves, allocating and deallocating memory as required, or by the operating system or other system program.
References in periodicals archive ?
Heap led out to the clubhouse on a fast mark and bowled two yards over.
However, in the same vein as the military maxim that "the enemy always gets a vote" in a battle's outcome, a number of complicating factors often have votes in the outcome of a heap leaching campaign.
This modification to its Water Pollution Control Plan for various expansions of the heap leach facility allows the construction of "Cell 10," located adjacent to and north of the existing leaching operation, and identifies multiple, future heap leach pad expansions, south and southwest of the existing heap leach pad and existing facilities.
One more register is maintained which is termed as darra register (heap register) in which weight of each heap formed in the open compound on the platforms or floor in case the platforms are short of storage capacity to accommodate more cotton is recorded.
Heap, who coaches rugby league for the North East Regional Academy, Gateshead Thunder and Jarrow Vikings, was nominated for the Heather Crouch Young Coach of the Year at the UK Coaching Awards, supported by Gillette, in Glasgow.
This starts a series that graduates of Septimus Heap, as well as readers looking for an engaging new series, will love.
One Park Lane Limited has applied to demolish the derelict Heaps Mill, a former rice warehouse in the Baltic Triangle, and build five blocks made up of 515 apartments in its place.
The construction of the heap leach can be commenced later in 2012 with first production of gold from the heap leach currently expected in mid-2013.
British electronic musician, multi-instrumentalist, singer and songwriter Imogen Heap has expanded her creative palette even further, recently launching work an album that will, in part, get its ideas from her fans and online community.
Small red balls with built-in temperature sensors are able to detect if a silage heap is no longer airtight.
Haystack is the name of a software project led by twenty-something San Francisco, California, technologist Austin Heap, who wanted to create a program