A Heap Is Also a Structure in Computing
A heap is an untidy pile. Computer science borrowed the word for two entirely different things.
A heap is an untidy pile of things, and informally a great quantity. Computing uses the word for two unrelated ideas: a *heap* data structure, a tree that keeps the largest or smallest item at the top, and *the heap*, the region of memory used for dynamic allocation. The two share a name by accident and confuse students regularly. *Heaps of* meaning plenty is informal British and Australian, and *heap of trouble* is much older.
- An untidy pile. *A heap of clothes.*
- A great quantity. *Heaps of time.*
- A data structure. *A binary heap.*
- Memory space. *Allocated on the heap.*
- Old English โ *heap*. *The source.*
Word forms
| Form | Word | Example |
|---|---|---|
| Noun | heap | A heap. |
| Plural | heaps | Heaps. |
| Verb | heap | Heaping. |
| Adjective | heaped | A heaped spoon. |
| Old English | heap | A heap. |
- Clothes lay in a heap.Pile.
- We have heaps of time.Quantity.
- Memory is taken from the heap.Computing.
Two heaps in computing
- The data structure keeps the largest or smallest item at the root
- It powers priority queues and the heapsort algorithm
- The memory region is where dynamically sized data is allocated
- The stack holds fixed-size local data instead
- The two senses are unrelated and frequently confused
Old English *heap*, a pile or multitude, of Germanic origin, related to German *Haufen*.
Are the two computing heaps related?
No. One is a tree structure keeping the extreme value at the root, the other is a region of memory. They share a name by accident.
What is a heaped spoonful?
One piled above the level of the rim, as opposed to a level spoonful scraped flat.