Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ huffify Public

Huffify is a Ruby gem that provides functionality to encode and decode text data using Huffman encoding, a lossless data compression algorithm. Huffman encoding efficiently compresses data by assigning shorter codes to more frequent symbols and longer codes to less frequent symbols.

License

Notifications You must be signed in to change notification settings

e1-m/huffify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Huffify

Huffify is a Ruby gem that provides functionality to encode and decode text data using Huffman encoding, a lossless data compression algorithm. Huffman encoding efficiently compresses data by assigning shorter codes to more frequent symbols and longer codes to less frequent symbols.

Installation

To install the gem, add this line to your application's Gemfile:

gem 'huffify'

Then execute:

bundle install

Or install it yourself as:

gem install huffify

Usage

Basic Encoding and Decoding

Here's how you can use the gem to encode and decode a string using Huffman encoding:

require 'huffify'
text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua."

result = Huffify::encode(text)

decoded_text = Huffify::decode(result[:encoded_text], result[:huffman_tree])

decoded_text == text  # true

License

The gem is available as open source under the terms of the MIT License.

About

Huffify is a Ruby gem that provides functionality to encode and decode text data using Huffman encoding, a lossless data compression algorithm. Huffman encoding efficiently compresses data by assigning shorter codes to more frequent symbols and longer codes to less frequent symbols.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published