huffman
huffman
Huffman Encoding
Installation
Add this to your application's shard.yml
:
dependencies:
huffman:
github: chenkovsky/huffman
Usage
require "huffman"
it "works" do
symbols = ["F", "O", "R", "G", "E", "T"]
freqs = [2, 3, 4, 4, 5, 7]
huff = Huffman.compile(freqs)
huff.path_codes.map { |_, _, bs| bs.map { |b| b ? "1" : "0" }.join("") }.should eq(["000", "100", "111", "011", "10", "01"])
end
TODO: Write usage instructions here
Development
TODO: Write development instructions here
Contributing
- Fork it (https://github.com/chenkovsky/huffman/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- chenkovsky chenkovsky - creator, maintainer
Repository
huffman
Owner
Statistic
- 2
- 0
- 0
- 0
- 0
- over 6 years ago
- July 28, 2018
License
MIT License
Links
Synced at
Thu, 07 Nov 2024 19:25:26 GMT
Languages