September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
10
Task/Huffman-coding/Zkl/huffman-coding-3.zkl
Normal file
10
Task/Huffman-coding/Zkl/huffman-coding-3.zkl
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
text:="this is an example for huffman encoding";
|
||||
encodeTable,decodeTable := buildHuffman(text);
|
||||
encodeTable.pump(Console.println,fcn(kv){"%s : %s".fmt(kv.xplode())});
|
||||
|
||||
e:=encode(text,encodeTable);
|
||||
"Encode %d characters (%d bits) to %d bits (%d bytes):"
|
||||
.fmt(text.len(),text.len()*8,e.len(),(e.len()+7)/8).println();
|
||||
println(e);
|
||||
|
||||
0'|Bits decoded to: "%s"|.fmt(decode(e,decodeTable)).println();
|
||||
Loading…
Add table
Add a link
Reference in a new issue