This class models a node structure used for building Huffman Binary Tree. More...
#include <BinNode.h>
Public Member Functions | |
BinNode (char) | |
BinNode (char, int) | |
bool | operator< (const BinNode &) |
This method overloads less than operator for comparing node. More... | |
bool | operator<= (const BinNode &) |
This method overloads less than and equal to (<=) operator for comparing node. More... | |
char | getCharacter () const |
int | getFrequency () const |
BinNode * | getLeftChild () const |
BinNode * | getRightChild () const |
void | setLeftChild (BinNode *) |
sets parameter node as left child of the caller node instance. More... | |
void | setRightChild (BinNode *) |
sets parameter node as left child of the caller node instance. More... | |
bool | isLeaf () |
Private Attributes | |
char | character |
Character present in input data. More... | |
int | frequency |
Number of occurrence of a character. More... | |
BinNode * | leftChild |
Pointer to the left child. More... | |
BinNode * | rightChild |
Pointer to the right child. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &, BinNode *) |
This method overloads insertion operator for printing node object. More... | |
std::ostream & | operator<< (std::ostream &, const BinNode &) |
This class models a node structure used for building Huffman Binary Tree.
It stores character and frequency data in a binary tree of character-frequency pair.
BinNode::BinNode | ( | char | character | ) |
Definition at line 3 of file BinNode.cpp.
BinNode::BinNode | ( | char | character, |
int | frequency | ||
) |
Definition at line 5 of file BinNode.cpp.
char BinNode::getCharacter | ( | ) | const |
Definition at line 25 of file BinNode.cpp.
int BinNode::getFrequency | ( | ) | const |
Definition at line 29 of file BinNode.cpp.
BinNode * BinNode::getLeftChild | ( | ) | const |
Definition at line 41 of file BinNode.cpp.
BinNode * BinNode::getRightChild | ( | ) | const |
Definition at line 45 of file BinNode.cpp.
bool BinNode::isLeaf | ( | ) |
true
if the caller node instance is leaf node. Definition at line 49 of file BinNode.cpp.
bool BinNode::operator< | ( | const BinNode & | other | ) |
This method overloads less than operator for comparing node.
Definition at line 17 of file BinNode.cpp.
bool BinNode::operator<= | ( | const BinNode & | other | ) |
This method overloads less than and equal to (<=) operator for comparing node.
Definition at line 21 of file BinNode.cpp.
void BinNode::setLeftChild | ( | BinNode * | left | ) |
sets parameter node as left child of the caller node instance.
Definition at line 33 of file BinNode.cpp.
void BinNode::setRightChild | ( | BinNode * | right | ) |
sets parameter node as left child of the caller node instance.
Definition at line 37 of file BinNode.cpp.
|
friend |
This method overloads insertion operator for printing node object.
Definition at line 7 of file BinNode.cpp.
|
friend |
Definition at line 12 of file BinNode.cpp.
|
private |
|
private |
|
private |