Malloc a new node. Take the two lowest frequency nodes and assign them to left and right of the new node, and put the sum of their frequencies in value of the new node. Delete the two nodes from the array by moving other elements down. Now insert the new node in the array after elements less than value and before elements greater than value, by moving the greater elements up one. The array now has one less element.
Repeat until there is one element in the array. That is the root of the tree.