标签:出现 txt return string 解码 cts read 字符 英文
public class HNode {
public String code = "";// 节点的哈夫曼编码
public String data = "";// 节点的数据
public int count;// 节点的权值
public HNode left;
public HNode right;
public HNode(String data, int count) {
this.data = data;
this.count = count;
}
public HNode(int count, HNode lChild, HNode rChild) {
this.count = count;
this.left = lChild;
this.right = rChild;
}
public HNode getLeft() {
return left;
}
public void setLeft(HNode left) {
this.left = left;
}
public HNode getRight() {
return right;
}
public void setRight(HNode right) {
this.right = right;
}
}
private void Sort(LinkedList<HNode> nodelist) {
for (int i = 0; i < nodelist.size() - 1; i++) {
for (int j = i + 1; j < nodelist.size(); j++) {
HNode temp;
if (nodelist.get(i).count > nodelist.get(j).count) {
temp = nodelist.get(i);
nodelist.set(i, nodelist.get(j));
nodelist.set(j, temp);
}
}
}
}`
File file = new File("C:\\Users\\lenovo\\IdeaProjects\\why20172321\\src\\week10\\哈夫曼树解码\\hfm.txt");
Reader reader = new FileReader(file);
BufferedReader bufferedReader = new BufferedReader(reader);
String data = bufferedReader.readLine();
标签:出现 txt return string 解码 cts read 字符 英文
原文地址:https://www.cnblogs.com/N-idhogg/p/10105547.html