Arithmetic coding/As a generalized change of radix: Difference between revisions

m
→‎{{header|Ruby}}: simplified the cumulative_freq() function
m (→‎{{header|Perl 6}}: simplified the cumulative_freq() function)
m (→‎{{header|Ruby}}: simplified the cumulative_freq() function)
Line 574:
cf = {}
total = 0
(0freq.keys.255)sort.each do |b|
cf[b] = total
if freq.has_key?(b)
total += cffreq[b] = total
total += freq[b]
end
end
return cf
2,747

edits