Represents a node in the Huffman encoding tree. More...
#include <Huffman.hpp>
Classes | |
struct | CompareNodes |
Comparator for use in priority queues (min-heap). More... | |
Public Member Functions | |
HuffmanNode (uint8_t character, uint64_t frecuency) | |
Constructor for a leaf node. | |
HuffmanNode (uint8_t character, uint64_t frecuency, unique_ptr< HuffmanNode > lft, unique_ptr< HuffmanNode > rght) | |
Constructor for an internal node. | |
Public Attributes | |
uint8_t | ch |
The character stored in this node (only valid for leaf nodes). | |
uint64_t | fr |
The frequency of the character or combined frequency of children. | |
unique_ptr< HuffmanNode > | left |
Pointer to the left child node. | |
unique_ptr< HuffmanNode > | right |
Pointer to the right child node. | |
Represents a node in the Huffman encoding tree.
Each node contains a character and its frequency, along with optional left and right child nodes for internal tree structure. Leaf nodes hold characters, while internal nodes combine frequencies.
HuffmanNode::HuffmanNode | ( | uint8_t | character, |
uint64_t | frecuency ) |
Constructor for a leaf node.
character | The character stored in the node. |
frecuency | The frequency of the character. |
HuffmanNode::HuffmanNode | ( | uint8_t | character, |
uint64_t | frecuency, | ||
unique_ptr< HuffmanNode > | lft, | ||
unique_ptr< HuffmanNode > | rght ) |
Constructor for an internal node.
character | The character stored. |
frecuency | The combined frequency of the child nodes. |
lft | Left child node. |
rght | Right child node. |
uint8_t HuffmanNode::ch |
The character stored in this node (only valid for leaf nodes).
uint64_t HuffmanNode::fr |
The frequency of the character or combined frequency of children.
unique_ptr<HuffmanNode> HuffmanNode::left |
Pointer to the left child node.
unique_ptr<HuffmanNode> HuffmanNode::right |
Pointer to the right child node.