A new recursive top-down algorithm for the construction of a unique Hu
ffman tree is introduced. We show that the prefix codes generated from
the Huffman tree are unique and the weighted path length is optimal.
Initially we have not imposed any restriction on the maximum length (t
he number of bits) a prefix code can take. But if buffering of the sou
rce is required, we have to put a restriction on the length of the pre
fix code. In this context we extend the top-down recursive algorithm f
or generating length-limited prefix codes.