Represents a single element (leaf or interior node) in the Huffman tree.
More...
#include <Node.h>
|
| | Node (uint8_t symbol, uint64_t frequency) |
| | Constructor for a new Node.
|
| uint64_t | getFrequency () const |
| | Gets the frequency of the node.
|
|
| static Node * | join (Node *leftChild, Node *rightChild) |
| | Joins two child nodes to create an interior parent node.
|
Represents a single element (leaf or interior node) in the Huffman tree.
◆ Node()
| Node::Node |
( |
uint8_t | symbol, |
|
|
uint64_t | frequency ) |
Constructor for a new Node.
- Parameters
-
| symbol | The 8-bit character this node represents. |
| frequency | The number of times this symbol appears in the input data. |
◆ getFrequency()
| uint64_t Node::getFrequency |
( |
| ) |
const |
|
inline |
Gets the frequency of the node.
- Returns
- The occurrence count of the symbol.
◆ join()
Joins two child nodes to create an interior parent node.
- The new parent node will have the symbol '$' and a frequency equal to the sum of its children's frequencies.
- Parameters
-
| leftChild | Pointer to the node that will become the left child. |
| rightChild | Pointer to the node that will become the right child. |
- Returns
- Pointer to the newly dynamically allocated parent node.
The documentation for this class was generated from the following files: