Question: import java.util.Comparator; import java.util.ArrayList; import java.io . IOException; import java.util.Scanner; import java.io . FileReader; public class HuffmanCodeGenerator { / * * * Generates a table

import java.util.Comparator;
import java.util.ArrayList;
import java.io.IOException;
import java.util.Scanner;
import java.io.FileReader;
public class HuffmanCodeGenerator
{
/**
* Generates a table with a list of codewords
* @param codeList the list of codes
* @return an array list sorted by symbols in ascending order
*/
public static ArrayList genTable(ArrayList codeList) throws PQueueException
{
//Implement this method
return null;
}
/**
* Generates Huffman codes given the root of a Huffman Tree
* @param root the root of a Huffman Tree
* @return an ArrayList containing SymData objects
*/
public static ArrayList genHuffCodes(SymData root) throws PQueueException
{
//Implement this method
return null;
}
/**
* Generates a binary Huffman Tree
* @param huffForest a forest of SymData objects
* @return a reference to the root of the Huffman tree
*/
public static SymData genHuffTree(PQueue huffForest) throws PQueueException
{
//Implement this method
return null;
}
public static void main(String[] args) throws IOException
{
try
{
String usage = "HuffmanCodeGenerator %n";
usage += "The data file name is entered as a command line argumet.%n";
usage += "The data file contains two columns per row.%n";
usage += "Each row has a symbol (char) and frequency pair.";
if (args.length !=1)
{
System.out.println("Invalid number of command line arguments");
System.out.println(usage);
System.exit(1);
}
//Complete the implementation of this method
}
catch(PQueueException e)
{
System.out.println(e);
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!