Builds an optimal prefix-free code for given frequencies by greedily merging the least frequent symbols first.
Explain code with DocComment! Try out your own code!