Question: Construct two different Huffman codes for these symbols and frequencies: t: 0.2, u: 0.3, v: 0.2, w: 0.3

I came up with the two on the top, the back of the book had the one on the bottom and said: "*There are four possible answers in all, the one shown here and three more obtained from this one by swapping t and v and / or swapping u and w.*"

I can't figure out how they got that graph, t and v should be the first combined, and their combined weight should be 0.4 forcing u and w to be the next two combined for .6 Then the two subgraphs should be combined.

At least, thats how I understand it, I may be confused, but I got the other questions correct, so IDK.

__Edit:__ if anyone needs it, here is the algorithm they gave for Huffman Coding.

**Procedure ***Huffman*(C: symbols with frequencies , i=1,...,n)

F := forest of n rooted trees, each consisting of the single vertex and assigned weight

**while **F is not a tree

**begin**Replace the rooted trees T and T' of least weights from F with w(T) __>__ w(T') with a tree

having a new root that has T as its left subtree and T' as its right subtree. Label the new edge

to T with 0 and the new edge to T' with 1

Assign w(T) + w(T') as the weight of the new tree.

**end**

{the Huffman coding for the symbol is the concatenation of the labels of the edges in the unique path from the root to the vertex }