Question: C++ You are to write a program that reads three text files given as command line parameters. The first file is an inorder traversal of
C++
You are to write a program that reads three text files given as command line parameters. The first file is an inorder traversal of a Huffman code tree and the second parameter is the postorder traversal of the same tree. The third file is the encoded text, given as ASCII 0s and 1s.
Your program should:
Compute the Huffman code tree from the two traversals.
Decode the text, writing the output to standard output (cout).
The format of the inorder and postorder traversals will be integer values separated by whitespace. The leaves of the tree will be values < 128, representing the ASCII value of the letter. The internal nodes of the tree will be values 128 and greater.
Requirements:
You should build all the data structures that you use yourself.
Your makefile should build the executable named decode.
You must use good object based organization, i.e. use classes in an appropriate way.
An example run ./decode inorder.txt postorder.txt encoded.txt
inorder.txt: 66 129 76 128 77 130 65
postorder.txt: 66 76 77 128 129 65 130
encoded.txt: 101010010111
Output should be: ALABAMA
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
