Question
Please give c++ pseudocode for the two function below. The first of these assumes that the tree represents a valid Huffman coding tree. /** A
Please give c++ pseudocode for the two function below. The first of these assumes that the tree represents a valid Huffman coding tree.
/** A recursive method that traverses a Huffman coding tree
and extracts a single code word
- initially called by getCodeFromHuffmanTree() nodePtr as root of the tree,
and str equal to the empty string ""
@param iChar - target character for which the Huffman code should be extracted
@param nodePtr - a pointer to a node in this tree; consider this node to be the root of a subtree
@param str - a string to contain the code word; for example "1011"
@return true if the code word is complete; otherwise false
*/
1. bool getCodeFromHuffmanTreeHelper(char iChar, BinaryNode
// Return a string containing ones and zeros
// that represents the Huffman code for the given target character iChar;
// this should call the recursive function getCodeFromHuffmanTreeHelper()
2.std::string getCodeFromHuffmanTree(char iChar) const;
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started