This repository contains an implementation of the LZ77 algorithm, a lossless data compression method. The program provides efficient compression and decompression algorithms for reducing the size of data files.
- Compression: The program takes an input string and compresses it using the LZ77 algorithm. It generates a sequence of tokens representing the offset, length of the match, and code word for each compressed segment.
- Decompression: The program can also decompress a sequence of tokens generated by the compression algorithm, reconstructing the original input string.
- Adjustable Parameters: The program allows you to adjust the window size, search buffer size, and look-ahead buffer size in the code. Modify the
window_size
,search_buffer
, andlook_ahead_buffer
variables in the code to customize these parameters based on your requirements. - Compression Output: The compressed output is displayed as a sequence of tokens in the format
<offset, length of match, codeword>
. Each token represents a compressed segment of the input string. - Decompression Output: The program can decompress the sequence of tokens generated during compression and reconstruct the original input string.
- User Input: The program prompts the user to enter an input string for compression and decompression.
- Clone the repository:
https://github.com/Sahil-4555/lZ77_Compression_Decompression.git
- Compile the source code:
g++ lz77.cpp -o lz77
- Run the program:
./lz77