This commit is contained in:
2024-12-31 21:07:05 -05:00
parent 9f5b75c782
commit bc72a32f7c
3 changed files with 7 additions and 24 deletions

View File

@@ -2,6 +2,7 @@ package huffman_coding;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import tester.Tester; import tester.Tester;
class Examples { class Examples {
@@ -41,13 +42,13 @@ class Huffman {
ArrayList<Integer> freqs; // Frequencies of characters. ArrayList<Integer> freqs; // Frequencies of characters.
Huffman(ArrayList<String> charset, ArrayList<Integer> freqs) { Huffman(ArrayList<String> charset, ArrayList<Integer> freqs) {
if (charset.size() != freqs.size()) throw new IllegalArgumentException( if (charset.size() != freqs.size())
"Character set must match frequencies." throw new IllegalArgumentException(
); "Character set must match frequencies.");
if (charset.size() < 2) throw new IllegalArgumentException( if (charset.size() < 2)
"Character set too small." throw new IllegalArgumentException(
); "Character set too small.");
this.charset = charset; this.charset = charset;
this.freqs = freqs; this.freqs = freqs;

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="lib" path="/home/jacob/Projects/CS3/libs/javalib.jar"/>
<classpathentry kind="lib" path="/home/jacob/Projects/CS3/libs/tester.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@@ -5,14 +5,8 @@
<projects> <projects>
</projects> </projects>
<buildSpec> <buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures> </natures>
<filteredResources> <filteredResources>
<filter> <filter>