Question: Task For this project, you have been provided an implementation of the Huffman tree con struction algorithm (DO NOT modify this code. It is possible

 Task For this project, you have been provided an implementation of

Task For this project, you have been provided an implementation of the Huffman tree con struction algorithm (DO NOT modify this code. It is possible to construct multiple Huffman trees with the same message if num same frequency value. The construct function that I set up ensures that your Huff man tree will produce results consistent with the test cases used for grading). This algorithm utilizes a templated min heap class that you must implement. You must also implement a function that prints the Huffman encoding of message using the Huffman tree constructed from the same message. Specifically, you must implement the following functions: erous charac ters in the message share the void MinHeap: :insert (const T data, const int key) Insert the provided user data into the min heap using the provided key to make comparisons with the other elements in the min heap To ensure that your min heap produces consistent results, stop bubbling up a child node if it shares the same key value as its parent node T MinHeap: :extract min() Remove from the min heap the element with the smallest key value and return its data. If you come across two sibling nodes that share the same key value while sifting down a parent node with a larger key value, then you should swap the parent node with the left child to ensure that your min heap produces consistent results. T MinHeap: :peek const: Retrieve the minimum element in the min heap and return its data to the user Do not remove this element from the min heap in this function. void MinHeap: :size) const: Return the size of the min heap void HuffmanTree: :print() const: Print the Huffman encoding of the member variable message assigned in the construct function

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!