public abstract class ImmutableLeftistHeap<T extends Comparable<T>> extends Object implements ImmutableHeap<T>
| Modifier and Type | Class and Description |
|---|---|
private static class |
ImmutableLeftistHeap.Empty<S extends Comparable<S>>
Singleton class for empty heaps
|
private static class |
ImmutableLeftistHeap.Node<S extends Comparable<S>>
Class for non-empty heaps
|
private static class |
ImmutableLeftistHeap.SortedIterator<T extends Comparable<T>>
Class for iterating the elements of a heap in increasing order
|
private static class |
ImmutableLeftistHeap.UnsortedIterator<T extends 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.
|
ImmutableHeap<T> |
insert(Iterator<T> elements)
Add multiple elements to this heap object
|
Iterator<T> |
iterator() |
static <T extends Comparable<T>> |
nilHeap() |
Iterator<T> |
sortedIterator() |
String |
toString() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdeleteMin, findMin, insert, insert, isEmpty, removeAll, sizeforEach, spliteratorprivate static final long serialVersionUID
public static <T extends Comparable<T>> ImmutableLeftistHeap<T> nilHeap()
protected abstract int getRightHeight()
public ImmutableHeap<T> insert(Iterator<T> elements)
insert in interface ImmutableHeap<T extends Comparable<T>>elements - the elements to be addedelementspublic Iterator<T> iterator()
iterator in interface Iterable<T extends Comparable<T>>public Iterator<T> sortedIterator()
sortedIterator in interface ImmutableHeap<T extends Comparable<T>>