Question: Write a method in java that will create a Huffman tree considering below; HuffmanNode class has the public class variables; float frequency, String symbol, HuffmanNode
Write a method in java 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.LinkedListHuffman 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 insertSortedHuffmandNode newONe insert a given node into the linked list in an ascending order based on their frequencies.
Public HuffmanNode deleteremove the first elementwith 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 createHuffmanTreeLinkedListHuffman listlist is the sorted one based on frequencies
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
