A Node of an Huffman tree, which can either be a leaf or an internal node. Each node has a weight. A leaf node has an associated symbol, but no children (i.e., left == right == nil). A parent node has a left and right child and no symbol (i.e., symbol == -1).
| 17 | // A leaf node has an associated symbol, but no children (i.e., left == right == nil). |
| 18 | // A parent node has a left and right child and no symbol (i.e., symbol == -1). |
| 19 | type Node struct { |
| 20 | left *Node |
| 21 | right *Node |
| 22 | symbol rune |
| 23 | weight int |
| 24 | } |
| 25 | |
| 26 | // A SymbolFreq is a pair of a symbol and its associated frequency. |
| 27 | type SymbolFreq struct { |
nothing calls this directly
no outgoing calls
no test coverage detected