huffman-encode
v0.1.1
Published
Huffman Coding
Downloads
2
Readme
Installation
$ npm install huffman-encode
// or
$ yarn add huffman-encode
Usage
const huffmanEncode = require('huffman-encode')
const probabilities = {
a: 1,
b: 2,
c: 3,
d: 4,
e: 5,
f: 6,
}
huffmanEncode(probabilities)
// => {
// "a": "1110",
// "b": "1111",
// "c": "110",
// "d": "00",
// "e": "01",
// "f": "10",
// }