EC330 Applied Algorithms and Data Structures for Engineers Homework 8 solution

$24.99

Original Work ?

Download Details:

  • Name: Homework-8-v2qatv.zip
  • Type: zip
  • Size: 118.59 KB

Category: You will Instantly receive a download link upon Payment||Click Original Work Button for Custom work

Description

5/5 - (2 votes)

4.Programming [40 pt]
For the programming part, make sure to write your name and BU ID in a comment at
the top of the program, along with your collaborator’s name and BU ID, if any. While
you are allowed to consult textbooks and web sources, you are supposed to write the
answer on your own (with the exception that you may share code with your
collaborator) and you should acknowledge all sources. To use the compiler on the lab
computers, run “module load gcc” first.
You are provided with a map representing characters and their frequencies, as well as a
text file, encoded.txt, containing Huffman encoded text.
Implement a Huffman class that
• generates a Huffman tree from the provided map,
• prints the generated tree in table format (containing Huffman Code and
corresponding Character columns),
• and then prints out the decoded (i.e. uncompressed) text version of the provided
file.
To generate the Huffman tree, you should use a min-heap priority queue (from the
Standard Library).
Your code should compile and run with the provided, unmodified, main.cpp file, to
generate the following output:
Huffman Code Character
———————————
0 g
10 o
110 e
111 l
The decoded text is: googgle
Submit your code as a single Problem3.zip file consisting of your code (without
main.cpp), along with a modified makefile that was used to compile it on the lab
computers.