Note: An optimal code is always represented by a full binary tree in which
every non-leaf node has exactly two children.
Given tree T, compute the number of bits to represent file.
Let C = set of unique characters in file.
Let f(c) = frequency of character c in file.
Let dT(c) = depth of c's leaf node in T
Then, the number of bits required to encode a file B(T) =
B(T) = cost of tree T