|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.mhhe.clrs2e.Heap | +--com.mhhe.clrs2e.MinHeap
Implements a binary min-heap, based on Chapter 6 of Introduction to Algorithms, Second edition.
Nested Class Summary |
Nested classes inherited from class com.mhhe.clrs2e.Heap |
Heap.Handle, Heap.Heapsort |
Field Summary |
Fields inherited from class com.mhhe.clrs2e.Heap |
array, heapSize |
Constructor Summary | |
(package private) |
MinHeap()
Creates an empty min-heap. |
(package private) |
MinHeap(java.lang.Comparable[] array)
Makes a min-heap in place from the argument, and ensures that the min-heap property holds. |
Method Summary | |
void |
heapify(int i)
Restores the min-heap property. |
Methods inherited from class com.mhhe.clrs2e.Heap |
buildHeap, exchange, head, isEmpty, left, makeSorter, parent, right |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
MinHeap()
MinHeap(java.lang.Comparable[] array)
array
- Array from which a min-heap is made.Method Detail |
public void heapify(int i)
heapify
in class Heap
i
- Index of the position at which the min-heap property
might not hold.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |