Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Huffman Coding Problem Statement The goal is to convert a character String into a binary string Huffman encoding. Some of the files have been

image text in transcribed
1. Huffman Coding Problem Statement The goal is to convert a character String into a binary string Huffman encoding. Some of the files have been provided on Moodle, such as Huffman.java, Node.java and Tree.java. There are some gaps you will have to fill in. As we've seen, the way a Huffman tree is built is not deterministic, because when you have multiple trees with the same lowest weighting, you can choose any two of those to connect together, and you can put either one on the left or right. So let's make it deterministic by saying - where multiple trees have equal frequency, always connect the two trees containing the two lowest value ASCII characters, and always put the lowest of those two on the left. For instance, every ASCII character is associated with a number, so every tree will have a lowest value ASCII character in it-(e.g. capital A is the lowest ASCII letter). Always connect the two trees that have the lowest characters anywhere inside them, with the lowest on the left. Now everybody should end up with the same trees and the same coding. This as simple as saying: take the Priority Queue and as well as sorting on frequency, sort on lowest character as well. When two are popped from the Priority Queue, put the first to be popped on the left. Input Format A String like "hello" Output Format The Huffman encoding in binary like "1111100010" Sample Input hello Sample Output 1111100010 (try it on paper for yourself)

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 And Relational Theory Normal Forms And All That Jazz

Authors: Chris Date

1st Edition

1449328016, 978-1449328016

More Books

Students also viewed these Databases questions

Question

=+7. What is the big message you want them to know? (THINK SLOGAN.)

Answered: 1 week ago

Question

What is the relation of physical mathematics with examples?

Answered: 1 week ago

Question

What are oxidation and reduction reactions? Explain with examples

Answered: 1 week ago