Huffman.Helpers
SourceSummary↑
byte_frequencies(arg1) | Counts the frequency of bytes in a given binary |
inspect_bits(bits) | |
sort_frequencies(arg1, arg2) |
Functions
Counts the frequency of bytes in a given binary.
Returns a list of tuples, the first element is the byte and the second is the number of occurences. The list is sorted first by the count, falling back to comparing the bytes themselves.
iex> Huffman.Helpers.byte_frequencies("bobbing")
[{"g", 1}, {"i", 1}, {"n", 1}, {"o", 1}, {"b", 3}]