Build a Huffman Encoding Tree in JAVA using the frequency table shown below. 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. All input and output should be read from named txt files and written to named txt files. Only standard JAVA should be used the use of standard libraries is restricted to I/O calls and standard math functions. See image.

In a word file named Summary write an analysis considering whether any useful data compression occurred with this method. Compare it to conventional encoding.

How would your results be affected by using a different scheme to break ties such as giving precedence to alphabetical ordering and then to the number of letters in the key? What other structures did you use and why?

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
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
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.