Skip to content

[FEATURE REQUEST] Add Compression Algorithms and create a new 'compression' category #6778

@Microindole

Description

@Microindole

What would you like to Propose?

I would like to propose adding a new compression category to the project. The primary goal is to add new implementations for the following fundamental lossless compression algorithms:

  • Run-Length Encoding (RLE)
  • Shannon-Fano Coding

This will create a dedicated section for learners to study important compression techniques.

A question regarding project structure:

I noticed that the existing Huffman.java algorithm is currently located in the others directory. For better organization and consistency, would the maintainers like me to move this file into the new compression category as part of this contribution? I am happy to include this file move in my Pull Request if you agree.

Issue details

  • Algorithm Name: Run-Length Encoding (RLE)
  • Problem Statement: Given a sequence of data (like a string), RLE is a lossless data compression technique that replaces consecutive runs of the same data value with a single data value and its count.
  • Example:
    • Input: "AAAABBBCCDAA"
    • Output: "4A3B2C1D2A"
  • File Path: compression/RunLengthEncoding.java

  • Algorithm Name: Shannon-Fano Coding
  • Problem Statement: Shannon-Fano is an entropy encoding technique for lossless data compression. It assigns variable-length codes to symbols based on their frequencies of occurrence.
  • Example:
    • Input: A set of symbols with their frequencies, e.g., A: 15, B: 7, C: 6, D: 6, E: 5
    • Output: A code table, e.g., A: 00, B: 01, C: 10, D: 110, E: 111
  • File Path: compression/ShannonFano.java

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions