Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write the code to create a Huffman Encoding Tree, as discussed in class. The tree should encode strings of vowels, with the following weights

image text in transcribed

Please write the code to create a Huffman Encoding Tree, as discussed in class. The tree should encode strings of vowels, with the following weights for each vowel A:20, E:15, 1:5, 0:5, U:10 The final tree should end up SIMILAR TO this - the bit strings may differ slightly, though the nodes should end up in the same relative positions 58 A 20 35 E 15 10 20 U 10 10 0 5 1100 101 Your Huffman Tree should be in a tree structure, using nodes and pointers to children nodes. To construct the tree, follow the general algorithm in class: 1. Make a list of nodes out of the provided vowel weight table 2. Sort the list on their weights/probabilities 3. Until the list only has one element a. Pop the two smallest b. Turn them into a subtree with a new node c. Add the new root back into the list d. Sort the list Further, you must implement code to decode and encode strings using your Huffman tree. Please make an encode and a decode method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions