dataStructures
Class MaxHblt
java.lang.Object
|
+--dataStructures.MaxHblt
- public class MaxHblt
- extends java.lang.Object
- implements MaxPriorityQueue
Method Summary |
java.lang.Comparable |
getMax()
|
void |
initialize(java.lang.Comparable[] theElements,
int theSize)
initialize leftist tree to elements in array theElements |
boolean |
isEmpty()
|
static void |
main(java.lang.String[] args)
test program |
void |
meld(MaxHblt x)
meld the max leftist trees this and x
on exit, this is the result |
void |
put(java.lang.Comparable theElement)
put theElement into the leftist tree |
java.lang.Comparable |
removeMax()
remove max element and return it |
int |
size()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
MaxHblt
public MaxHblt()
isEmpty
public boolean isEmpty()
- Specified by:
- isEmpty in interface MaxPriorityQueue
- Returns:
- true iff the tree is empty
size
public int size()
- Specified by:
- size in interface MaxPriorityQueue
- Returns:
- number of elements in the tree
getMax
public java.lang.Comparable getMax()
- Specified by:
- getMax in interface MaxPriorityQueue
- Returns:
- maximum element
meld
public void meld(MaxHblt x)
- meld the max leftist trees this and x
on exit, this is the result
put
public void put(java.lang.Comparable theElement)
- put theElement into the leftist tree
- Specified by:
- put in interface MaxPriorityQueue
removeMax
public java.lang.Comparable removeMax()
- remove max element and return it
- Specified by:
- removeMax in interface MaxPriorityQueue
initialize
public void initialize(java.lang.Comparable[] theElements,
int theSize)
- initialize leftist tree to elements in array theElements
toString
public java.lang.String toString()
- Overrides:
- toString in class java.lang.Object
main
public static void main(java.lang.String[] args)
- test program