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 *nodePtr,std::string& str) const;

// 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!