- Notifications
You must be signed in to change notification settings - Fork 20.6k
Closed
Labels
Description
What would you like to Propose?
I would like to propose adding implementations for the following fundamental lossless compression algorithms to the compression
category:
- LZW (Lempel–Ziv–Welch)
- Arithmetic Coding
This will significantly enhance the collection of classic compression techniques available in the repository.
Issue details
Algorithm 1: LZW (Lempel–Ziv–Welch)
- Problem Statement: LZW is a universal lossless data compression algorithm that works by building a dictionary of frequently used strings of data and replacing them with shorter codes.
- Example:
- Input:
"TOBEORNOTTOBEORTOBEORNOT"
- Output:
[84, 79, 66, 69, 79, 82, 78, 79, 84, 256, 258, 260, 265, 259, 261, 263]
- Input:
- File Path:
src/main/java/com/thealgorithms/compression/LZW.java
Algorithm 2: Arithmetic Coding
- Problem Statement: Arithmetic coding is a form of entropy encoding that encodes an entire message into a single number, a fraction
n
where(0.0 <= n < 1.0)
. It can achieve higher compression ratios than Huffman coding. - Example:
- Input: A string, e.g.,
"BABA"
with symbol probabilitiesA: 0.5
,B: 0.5
. - Output: A single floating-point number representing the compressed data, e.g.,
0.5625
. The decompression process uses this number and the symbol probabilities to reconstruct the original string.
- Input: A string, e.g.,
- File Path: `src/main/java/com/thealgorithms/compression/ArithmeticCoding.java
Additional Information
No response