|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectHuffmanHeap
public class HuffmanHeap
An HNode min-heap (priority queue) for generating Huffman codes. The HNode getFrequency() method is used for the key/priority.
| Constructor Summary | |
|---|---|
HuffmanHeap()
|
|
| Method Summary | |
|---|---|
void |
insert(HNode node)
Insert a node into the heap. |
boolean |
isEmpty()
Predicate for empty heap. |
HNode |
remove()
Remove the min-node (root) of this heap. |
int |
size()
Return the number of nodes in this heap. |
java.lang.String |
toString()
Printable string. Format: <Heap: node0;node1; ...> |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public HuffmanHeap()
| Method Detail |
|---|
public boolean isEmpty()
true if this heap has no nodes; false otherwisepublic int size()
public void insert(HNode node)
node - the node to be insertedpublic HNode remove()
public java.lang.String toString()
<Heap: node0;node1; ...>
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||