Question
Implement a Huffman Coding Tree Do not use javas search or sort methods. Do not use any java pre-built data structures besides arrays! Do not
Implement a Huffman Coding Tree
Do not use javas search or sort methods. Do not use any java pre-built data structures besides arrays! Do not use Javas Collections or Subclasses!
(a) Your tree should build itself using
'twas brillig, and the slithy toves did gyre and gimble in the wabe: all mimsy were the borogoves, and the mome raths outgrabe. "beware the jabberwock, my son! the jaws that bite, the claws that catch! beware the jubjub bird, and shun the frumious bandersnatch!" he took his vorpal sword in hand: long time the manxome foe he sought -- so rested he by the tumtum tree, and stood awhile in thought. and, as in uffish thought he stood, the jabberwock, with eyes of flame, came whiffling through the tulgey wood, and burbled as it came! one, two! one, two! and through and through the vorpal blade went snicker-snack! he left it dead, and with its head he went galumphing back. "and, has thou slain the jabberwock? come to my arms, my beamish boy! o frabjous day! callooh! callay!" he chortled in his joy. 'twas brillig, and the slithy toves did gyre and gimble in the wabe; all mimsy were the borogoves, and the mome raths outgrabe.
(b) Include the characters for spacing as well as all punctuation, but not line breaks.
(c) Don't make encoding for characters not found in the source text
(d) When Two characters with the same weight are merged into one subtree, program should choose for the left child, the element that came first in the source material.
(e) When two subtrees with the same weight are merged into one subtree, your program should choose for the left child, the element that came first in the priority queue or ordered list you were using to build the tree.
(f) Using the command line, your program should be called as java Huffman
(g)
(h) Upon starting, a frequency table will be built. Your program should listen to stdin (you may use Scanner) and encode any line entered (terminated by a line break) and output the encoded version using 1s and 0s (vs. padded ASCII).
(i) Your program should multiple lines to be entered, encoding each one as it is entered.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started