Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

File Compression using Huffman Coding The Problem You will be required to write a java application that uses Huffman compression to compress data in a

File Compression using Huffman Coding

The Problem

You will be required to write a java application that uses Huffman compression to compress data in a file named input.dat. For testing, you can use random text for the input.dat data, suggest using the first paragraph of the declaration of independence.

The main program module should be named Huffman.java

Load the file data in a persistent byte array named fileData, and will be a member of the Huffman class. This byte array will be used for building the frequency table, the Huffman tree, and outputting the bits.

The first step is to create a frequency table. The table will be an array of 256 integers and will be a member of the Huffman class. There must be a method named calculateFreqs to calculate a frequency table based on the loaded file data.

You must create class named BinaryMinHeap that acts as a Priority Queue. It should use generics for its type as discussed in class. You must support methods such as add and pop, and anything else necessary to operationsize being a good example.

You will need a data structure named HuffmanTreeNode. It is essentially a binary tree node. Use the class lecture to understand this and then to create the appropriate methods and fields.

Once the frequency table has been created, create a binary tree within a class named HuffmanTree. You will learn how to do this in class. An instantiation of theHuffmanTree class will be a member of the Huffman class.

With the binary tree created, create the compression table named compressionTable, as a member of the Huffman class. You will learn how to do this in class.

Finally, the output will go to the console. For each of the file bytes, output the uncompressed character following by the bit string that will be output.

The BinaryMinHeap class must support generics and implement Comparable.

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

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions

Question

How do mortgages work?

Answered: 1 week ago

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago