Skip to content

Commit a8c7539

Browse files
authored
Update TreeHuffmanDecoding.java
Added code/problem description.
1 parent dab317c commit a8c7539

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

TreeHuffmanDecoding.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
Huffman Coding Decoder
3+
4+
You are tasked with implementing a decoder for Huffman coding. Huffman coding is a lossless data compression algorithm
5+
that assigns variable-length codes to input characters based on their frequencies. More frequent characters are assigned shorter codes,
6+
while less frequent characters receive longer codes. Your goal is to decode a given binary-encoded string using a provided Huffman tree.
7+
8+
Input
9+
A string s representing the Huffman-encoded binary string (composed of '0's and '1's).
10+
A reference to the root node of a Huffman tree that has been constructed based on character frequencies.
11+
12+
Output
13+
A single line containing the decoded string.
14+
15+
Constraints
16+
The input string s will only contain characters '0' and '1'.
17+
The Huffman tree will be valid and contain characters in its leaf nodes.
18+
*/
19+
120
import java.util.*;
221

322
abstract class Node implements Comparable<Node> {

0 commit comments

Comments
 (0)