Why it is preferred to use heap instead of sorting methods like quick sort in Huffman algorithm?

# Huffman algorithm

**Sahieed**#2

Throughout this section we will assume that the number of characters is C. We maintain a forest of trees. The weight of a tree is equal to the sum of the frequencies of its leaves. C-1 times, select the two trees, T1 and T2, of smallest weight, breaking ties arbitrarily, and form a new tree with subtrees T1 amd T2. At the beginning of the algorithm, there are C single-node trees, one for each character. At the end of the algorithm there is one tree, and this is the optimal Huffman coding tree… I attached the worked example with this