code: func buildHuffmanTree(symFreqs []int) huffmanTree {
  	var trees treeHeap
  	for v, w := range symFreqs {
  		if w == 0 {
  			w = 1
  		}
  
  		trees = append(trees, &huffmanLeaf{w, v})
  	}
  
  	n := 40
  
  	heap.Init(&trees)
  	for trees.Len() > 1 {
  		a := heap.Pop(&trees).(huffmanTree)
  		b := heap.Pop(&trees).(huffmanTree)
  
  		heap.Push(&trees, &huffmanNode{a.Weight() + b.Weight(), n, a, b})
  		n++
  	}
  
  	return heap.Pop(&trees).(huffmanTree)
  }
docs: // Construct a tree from a map of weight -> item