Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2(25p) Write a method that will create a Huffman tree considering below; HuffmanNode class has the public class variables; float frequency, String symbol,

image text in transcribed

Question 2(25p) Write a method that will create a Huffman tree considering below; HuffmanNode class has the public class variables; float frequency, String symbol, HuffmanNode left, right, next. The constructor takes frequency and symbol values. Linked ListHuffman class has private class variable; HuffmanNode head and the following methods implemented in this class for you to use in case you need them; Public void insertSorted (HuffmandNode newONe) // insert a given node into the linked list in an ascending order based on their frequencies. Public HuffmanNode delete() //remove the first element(with the lowest frequency) from the linked list and returns it. Public int count() // will count the number of elements in the linked list. Assume that for each symbol in your text, the frequency was found, HuffmanNode was created and inserted into a linked list using the method mentioned above. The method that you are going to write will be in the HuffmanTree class. This class has a variable root in the type of HuffmanNode. Public void createHuffman Tree(Linked ListHuffman list){//list is the sorted one based on frequencies }

Step by Step Solution

3.35 Rating (161 Votes )

There are 3 Steps involved in it

Step: 1

To create a Huffman Tree we need to follow a specific algorithm that will construct the tree from a ... 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

Data Structures and Algorithm Analysis in Java

Authors: Mark A. Weiss

3rd edition

132576279, 978-0132576277

More Books

Students also viewed these Programming questions

Question

Why do joints tend to be evenly spaced rather than clustered?

Answered: 1 week ago

Question

Find the answer to Prob. 11 from (9b).

Answered: 1 week ago

Question

How can emotions cause communication breakdown?

Answered: 1 week ago