Unlike java.util.TreeSet, this data structure can handle duplicate entries.
Definition at line 40 of file Heap.java.
Public Methods | |
Heap (Comparator c) | |
Use given Comparator for all comparisons between elements in this Heap. | |
void | rebuildHeap () |
Ensure that every element in this heap obeys the heap property. | |
void | sort () |
Perform an in place heap sort on the data stored in this heap. | |
Protected Methods | |
int | cmp (int node1, int node2) |
Compare two Objects in this heap - wrapper around compareTo/Comparator.compare. |
|
Use given Comparator for all comparisons between elements in this Heap. Otherwise rely on compareTo methods and Comparable Objects. |
|
Ensure that every element in this heap obeys the heap property. Runs in linear time. This is meant to be called if/when the Comparator associated with this object is modified. |
|
Perform an in place heap sort on the data stored in this heap. After calling sort, a call to this objects iterator() method will iterate through the data stored in the heap in ascending sorted order. Reimplemented in meapsoft.MinHeap. |