In: Computer Science
Programming: Use the generic Huffman_Tree<T> on
Let us take the word 'assessment', First we need to write the frequency of each letter in the word:
| Letter | Freq. | 
| a | 1 | 
| s | 4 | 
| e | 2 | 
| m | 1 | 
| n | 1 | 
| t | 1 | 
To construct a tree, we merge the two letters with least frequency and repeat the process untill we get the single element, the tree generated is:

Huffman code for words are:
| Letter | Code | 
| a | 100 | 
| s | 0 | 
| e | 110 | 
| m | 101 | 
| n | 1110 | 
| t | 1111 | 
Encoded word: 100001100010111011101111