private static class ImmutableLeftistHeap.Empty<S extends java.lang.Comparable<S>> extends ImmutableLeftistHeap<S>
Modifier and Type | Field and Description |
---|---|
private static ImmutableLeftistHeap<?> |
EMPTY_HEAP
Use this element to construct new heaps
|
private static long |
serialVersionUID |
Modifier | Constructor and Description |
---|---|
private |
Empty() |
Modifier and Type | Method and Description |
---|---|
ImmutableHeap<S> |
deleteMin()
Remove the minimum element from this heap
|
S |
findMin() |
protected int |
getRightHeight()
Length of the right spine, i.e. the length of the path from the
root to rightmost leaf
|
ImmutableHeap<S> |
insert(ImmutableHeap<S> h)
Add multiple elements to this heap object
|
ImmutableHeap<S> |
insert(S element)
Add an element to this heap object
|
boolean |
isEmpty() |
ImmutableHeap<S> |
removeAll(S element)
Remove all elements of this heap which are
equal
to element . |
int |
size() |
insert, iterator, nilHeap, sortedIterator, toString
private static final long serialVersionUID
private static final ImmutableLeftistHeap<?> EMPTY_HEAP
protected int getRightHeight()
getRightHeight
in class ImmutableLeftistHeap<S extends java.lang.Comparable<S>>
public boolean isEmpty()
public ImmutableHeap<S> insert(S element)
element
- The element to be addedelement
public ImmutableHeap<S> insert(ImmutableHeap<S> h)
h
- a heap containing the elements to be addedh
public S findMin()
isEmpty()==true
)public ImmutableHeap<S> deleteMin()
public ImmutableHeap<S> removeAll(S element)
equal
to element
.element
removedpublic int size()