To accomplish this,
Huffman coding creates what is called a "Huffman tree", which is a binary tree
such as this one:

To read the codes from a Huffman tree, start from the root and add a '0' every time you
go left to a child, and add a '1' every time you go right. So in this example, the code
for the character 'A' is 0 and the code for 'D' is 110. In line with the first property of
variable length encoding schemes, the more frequently-occurring 'A' has a shorter code
than the rarer 'D'. Notice that since all the characters are at the leaves of the tree
(the ends), there is never a chance that one code will be the prefix of another one and
each code can be uniquely decoded.