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() |
private 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 addedelements
public Iterator<T> iterator()
iterator
in interface Iterable<T extends Comparable<T>>
public Iterator<T> sortedIterator()
sortedIterator
in interface ImmutableHeap<T extends Comparable<T>>