Question: Please note: this program is suppose to accept an input file and print out an output file. Using the frequency table shown below, build a

Please note: this program is suppose to accept an input file and print out an output file.

Using the frequency table shown below, build a Huffman Encoding Tree. Resolve ties by giving single letter groups precedence over multiple letter groups, then alphabetically. Do not worry about punctuation or capitalization.

Print out the tree by doing a preorder traversal. Print the resulting code. An example is given below for a 3-letter alphabet. You may use any reasonable format.

X 3

Y 1

Z 2

The tree in preorder is: XYZ: 6, X: 3, YZ: 3, Y: 1, Z: 2

The code is X = 0; Y = 10, Z = 11;

Encode the following strings, plus several others of your choice:

Sally sells seashells by the seashore.

Peter Piper picked a peck of pickled peppers a peck of pickled peppers Peter Piper

picked.

Houston, the Eagle has landed.

Is that your final answer?

Decode the following strings:

01011001010110011111011011

10110000101010011011101101100010110010101100010111000110111

11111110001000111111101011111011001111111000100011111000001010000001110

010111

A - 19

B - 16

C - 17

D - 11

XYZ:6

X:3 YZ:3

Y:1 Z:2

E - 42

F - 12

G 14

H 17

I - 16

J - 5

K - 10

L - 20

M - 19

N - 24

O - 18

P - 13

Q - 1

R - 25

S - 35

T - 25

U - 15

V - 5

W - 21

X - 2

Y - 8

Z - 3

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!