Heaps
An efficiently sorting dynamically sized data structure.
 |  | type Content_Type |  |
 | Type for items in the heap. |  |
 |  | type Heap |  |
 | Type for instances. Doesn't need to be initialized. Unitialized
heaps behave like regular empty ones. |  |
Heap size management
 |  | procedure Resize |  |
 | Grow or shrink a heap. If the new size is smaller than the
number of items in the heap, some items will be cut off at the
end without warning. |  |
|
 |  | procedure Deallocate |  |
 | Explicitly empty a heap and release associated memory. |  |
|
State information
 |  | function Count |  |
 | How many items in the heap? |  |
|
 |  | procedure Debug |  |
 | Print the heap's contents. |  |
|
Writing and reading
 |  | procedure Insert |  |
 | Insert an item into the heap. |  |
|
 |  | function Extract |  |
 | Extract the lightest item from the heap. |  |
|
|