public abstract class ImmutableLeftistHeap<T extends java.lang.Comparable<T>> extends java.lang.Object implements ImmutableHeap<T>
| Modifier and Type | Class and Description |
|---|---|
private static class |
ImmutableLeftistHeap.Empty<S extends java.lang.Comparable<S>>
Singleton class for empty heaps
|
private static class |
ImmutableLeftistHeap.Node<S extends java.lang.Comparable<S>>
Class for non-empty heaps
|
private static class |
ImmutableLeftistHeap.SortedIterator<T extends java.lang.Comparable<T>>
Class for iterating the elements of a heap in increasing order
|
private static class |
ImmutableLeftistHeap.UnsortedIterator<T extends java.lang.Comparable<T>>
Class for iterating the elements of a heap in unspecified order
|
| Modifier and Type | Field and Description |
|---|---|
private static long |
serialVersionUID |
| Constructor and Description |
|---|
ImmutableLeftistHeap() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract int |
getRightHeight()
Length of the right spine, i.e. the length of the path from the
root to rightmost leaf
|
ImmutableHeap<T> |
insert(java.util.Iterator<T> elements)
Add multiple elements to this heap object
|
java.util.Iterator<T> |
iterator() |
static <T extends java.lang.Comparable<T>> |
nilHeap() |
java.util.Iterator<T> |
sortedIterator() |
java.lang.String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitprivate static final long serialVersionUID
public static <T extends java.lang.Comparable<T>> ImmutableLeftistHeap<T> nilHeap()
protected abstract int getRightHeight()
public ImmutableHeap<T> insert(java.util.Iterator<T> elements)
insert in interface ImmutableHeap<T extends java.lang.Comparable<T>>elements - the elements to be addedelementspublic java.util.Iterator<T> iterator()
public java.util.Iterator<T> sortedIterator()
sortedIterator in interface ImmutableHeap<T extends java.lang.Comparable<T>>public java.lang.String toString()
toString in class java.lang.Object