June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -20,14 +20,13 @@ proc huffmanEncode {str args} {
}
set encoding [walkTree [$pq get]]
set map [dict create {*}[lreverse $encoding]]
if {$opts(-dump)} {
foreach key [lsort -command compare [dict keys $map]] {
set char [dict get $map $key]
puts "$char\t[dict get $charcount $char]\t$key"
foreach {char huffCode} [lsort -index 1 -stride 2 -command compare $encoding] {
puts "$char\t[dict get $charcount $char]\t$huffCode"
}
}
$pq destroy
return $encoding
}