https://github.com/anshuman-02/lzw-encoding-decoding
Python implementation of Lempel-Ziv-Welch (LZW) compression and decompression algorithm
https://github.com/anshuman-02/lzw-encoding-decoding
algorithms datacompression encodingdecoding losslesscompression lzw python
Last synced: about 1 year ago
JSON representation
Python implementation of Lempel-Ziv-Welch (LZW) compression and decompression algorithm
- Host: GitHub
- URL: https://github.com/anshuman-02/lzw-encoding-decoding
- Owner: Anshuman-02
- Created: 2025-01-21T13:27:49.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-21T13:35:36.000Z (over 1 year ago)
- Last Synced: 2025-01-21T14:28:35.422Z (over 1 year ago)
- Topics: algorithms, datacompression, encodingdecoding, losslesscompression, lzw, python
- Language: Python
- Homepage:
- Size: 512 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Lempel-Ziv-Welch (LZW) Encoding and Decoding 📜
This repository contains a Python implementation of the **Lempel-Ziv-Welch (LZW)** algorithm for data compression and decompression. The algorithm dynamically builds a dictionary to encode and decode variable-length input efficiently.
---
## Features
- **Encoding**: Compresses input strings into numeric codes.
- **Decoding**: Reconstructs the original string from the codes.
- **Dynamic Dictionary**: Handles variable-length inputs with a growing dictionary.
---
## How to Run
1. Install Python 3.x from [python.org](https://www.python.org/).
2. Save the script as `lzw_compression.py`.
3. Open a terminal and run:
```bash
python lzw_compression.py
4. Enter a string when prompted to see the encoded and decoded results.
## Example Usage
### Input:
Enter a message to encode: hello world
### Output:
- Encoded: [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
- Decoded: hello world
## Applications
- File compression for storage efficiency.
- Data transmission over networks.
- Lossless compression for text processing.