huffman-encoder
Huffman encoder
Last updated 3 years ago by aecostas .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install huffman-encoder 
SYNC missed versions from official npm registry.

Build Status

Generate huffman encoded symbols from an alphabet and its frequencies

Build

npm install
npm run build

Test

npm test

Usage

Review test/huffman.spec.js for a complete test suite

let encoded;
let alphabet; // array of frequencies
let code = [0, 1, 2];

alphabet = [
		{s: 'A', f: 6},
		{s: 'B', f: 4},
		{s: 'C', f: 3},
		{s: 'D', f: 3},
		{s: 'E', f: 2},
		{s: 'F', f: 2}];

encoded = lib.encode(code, alphabet);
{ E: '20', F: '21', B: '00', C: '01', D: '02', A: '1' }

Current Tags

  • 0.2.4                                ...           latest (3 years ago)

6 Versions

  • 0.2.4                                ...           3 years ago
  • 0.2.3                                ...           3 years ago
  • 0.2.2                                ...           3 years ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 1
Last Month 2
Dependencies (0)
None
Dev Dependencies (13)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |