📄 huffmannode.java
字号:
// Introduced in Chapter 17/** Node in a Huffman tree. */public class HuffmanNode extends BinaryNode<Character> implements Comparable<HuffmanNode> { /** Frequency of this letter or set of letters. */ private int count; /** Create a node with no children. */ public HuffmanNode(char letter, int count) { super(letter); this.count = count; } /** * Create a node with two children. Its count is the sum of * its children's counts. */ public HuffmanNode(HuffmanNode left, HuffmanNode right) { super('?', left, right); this.count = left.count + right.count; } /** The comparison is based on the counts of the nodes. */ public int compareTo(HuffmanNode that) { return count - that.count; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -