|
|||||||||
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.MaxHeap
Implements a binary max-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) |
MaxHeap()
Creates an empty max-heap. |
(package private) |
MaxHeap(java.lang.Comparable[] array)
Makes a max-heap in place from the argument, and ensures that the max-heap property holds. |
Method Summary | |
void |
heapify(int i)
Restores the max-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 |
MaxHeap()
MaxHeap(java.lang.Comparable[] array)
array
- Array from which a max-heap is made.Method Detail |
public void heapify(int i)
heapify
in class Heap
i
- Index of the position at which the max-heap property
might not hold.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |