public class HuffNode implements Comparable{
public char lett;//字母
public int freq;//频率
public HuffNode left;//左节点
public HuffNode right;//右节点
public HuffNode(){
lett = ‘\0‘;
freq = 0;
left = right =null;
}
public HuffNode(int freq){
this.freq = freq;
}
/**
* 和that比较频率大小
* @param that
* @return
*/
public int compareTo(Object that){
HuffNode other = (HuffNode)that;
return freq - other.freq;
}
public String toString(){
return lett+"/"+freq;
}
}