Main Page   Class Hierarchy   Compound List   File List   Compound Members  

meapsoft.Heap Class Reference

Inheritance diagram for meapsoft.Heap:

Inheritance graph
[legend]
Collaboration diagram for meapsoft.Heap:

Collaboration graph
[legend]
List of all members.

Detailed Description

Abstract implementation of the basic functions needed for a binary qheap using java.util.Vector as a backend.

Unlike java.util.TreeSet, this data structure can handle duplicate entries.

Author:
Ron Weiss (ronw@ee.columbia.edu)

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.


Constructor & Destructor Documentation

meapsoft.Heap.Heap Comparator    c [inline]
 

Use given Comparator for all comparisons between elements in this Heap.

Otherwise rely on compareTo methods and Comparable Objects.

Definition at line 58 of file Heap.java.


Member Function Documentation

void meapsoft.Heap.rebuildHeap   [inline]
 

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.

Definition at line 152 of file Heap.java.

void meapsoft.Heap.sort   [inline]
 

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.

Definition at line 167 of file Heap.java.


The documentation for this class was generated from the following file:
Generated on Thu May 11 15:04:13 2006 for MEAPsoft by doxygen1.2.18