June 2018 Update
This commit is contained in:
parent
ba8067c3b7
commit
22f33d4004
5278 changed files with 84726 additions and 14379 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue