Java算法代写 | CMSI 282 Homework 4 – Huff and Puff

本次北美CS代写主要是使用Java实现霍夫曼编码文本压缩算法
In particular, you will gain practice with the following topics:

  • Greedy Programming: practice with implementing a greedy approach to an important, real-world problem.
  • Prefix Tries: a particular tree-like data structure meant to model prefixes along some path; in this case, the bits composing some Huffman Code.
  • Compression: seeing, first-hand, how to compress some corpus of text into a representation that consumes fewer bits than its original.

Although less general than an arbitrary Huffman Encoder, the ability to create instances of our reusable variant saves the effort of having to reconstruct or transmit the Huffman Trie every time a new message is compressed or decompressed.

These two primary operations proceed as follows:

  1. Compression: finding the distribution of characters in the corpus, using these frequencies to find the Huffman Trie, after which we construct the Encoding Map that performs the compression.
  2. Decompression: given some bitstring (in this assignment, some sequence of bytes each 8 bits in length), decode the original corpus using a Huffman Trie.

 

With these details in place, let’s look at the specifications.

Simplifications and Assumptions