// Source code example for "A Practical Introduction // to Data Structures and Algorithm Analysis" // by Clifford A. Shaffer, Prentice Hall, 1998. // Copyright 1998 by Clifford A. Shaffer class HuffTree { // A Huffman coding tree private BinNode root; // Root of the Huffman coding tree public HuffTree(LettFreq val) { root = new BinNodePtr(val); } public HuffTree(LettFreq val, HuffTree l, HuffTree r) { root = new BinNodePtr(val, l.root(), r.root()); } public BinNode root() { return root; } public int weight() // Weight of tree is weight of root node { return ((LettFreq)root.element()).weight(); } } // class HuffTree