public class GraphHuffman extends Object implements BinaryTree
| Constructor and Description |
|---|
GraphHuffman(int nVertices) |
GraphHuffman(int nVertices,
int maxCodeLength) |
| Modifier and Type | Method and Description |
|---|---|
void |
buildTree(int[] vertexDegree)
Build the Huffman tree given an array of vertex degrees
|
long |
getCode(int vertexNum) |
int |
getCodeLength(int vertexNum) |
String |
getCodeString(int vertexNum) |
int[] |
getPathInnerNodes(int vertexNum) |
public GraphHuffman(int nVertices)
nVertices - number of vertices in the graph that this Huffman tree is being built forpublic GraphHuffman(int nVertices,
int maxCodeLength)
nVertices - nVertices number of vertices in the graph that this Huffman tree is being built formaxCodeLength - MAX_CODE_LENGTH for Huffman treepublic void buildTree(int[] vertexDegree)
vertexDegree - vertexDegree[i] = degree of ith vertexpublic long getCode(int vertexNum)
getCode in interface BinaryTreepublic int getCodeLength(int vertexNum)
getCodeLength in interface BinaryTreepublic String getCodeString(int vertexNum)
getCodeString in interface BinaryTreepublic int[] getPathInnerNodes(int vertexNum)
getPathInnerNodes in interface BinaryTreeCopyright © 2016. All Rights Reserved.