资源简介
huffman树,算法分析与设计huffman树,算法分析与设计huffman树,算法分析与设计huffman树,算法分析与设计huffman树,算法分析与设计
代码片段和文件信息
import java.util.Stack;
public class Bintree {
private TreeNode root;
public void makeTree(Integer integer Bintree lt Bintree rt) {
root=new TreeNode(integer);
root.element=integer;
root.left=lt.root;
root.right=rt.root;
}
public void displayTree(){
Stack gloabalStack = new Stack();
gloabalStack.push(root);
int nBlanks =50;
boolean isRowEmpty = false;
System.out.println(“...............................................................................................“);
while(isRowEmpty == false){
Stack localStack = new Stack();
isRowEmpty = true;
for(int j=0;j System.out.print(‘ ‘);
while(gloabalStack.isEmpty() == false){
TreeNode temp = (TreeNode)gloabalStack.pop();
if(temp!= null){
System.out.print(temp.element);
localStack.push(temp.left);
localStack.push(temp.right);
if(temp.left != null || temp.right != null)
isRowEmpty = false;
}
else{
System.out.print(“--“);
localStack.push(null);
localStack.push(null);
}
for(int j=0;j System.out.print(‘ ‘);
}
System.out.println();
System.out.println();
nBlanks /= 2;
while(localStack.isEmpty()==false)
gloabalStack.push(localStack.pop());
}
System.out.println(“..................................................................................................“);
}
private static class TreeNode {
object element;
TreeNode left;
TreeNode right;
public TreeNode(object o) {
element = o;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 450 2011-05-11 15:20 Huffman\Bintree$TreeNode.class
文件 1934 2011-05-11 15:20 Huffman\Bintree.class
文件 1699 2008-11-11 09:38 Huffman\Bintree.java
文件 625 2011-05-11 15:20 Huffman\Huffman.class
文件 285 2006-11-09 15:07 Huffman\Huffman.java
文件 913 2011-05-11 15:36 Huffman\Huffman.jcp
文件 715 2011-05-11 15:36 Huffman\Huffman.jcu
文件 290 2011-05-11 15:36 Huffman\Huffman.jcw
文件 1926 2011-05-11 15:20 Huffman\Mianhuffam.class
文件 913 2011-05-11 10:15 Huffman\Mianhuffman.java
文件 2732 2011-05-11 15:20 Huffman\MinHeap.class
文件 2154 2008-11-19 21:57 Huffman\MinHeap.java
文件 164 2011-05-11 15:20 Huffman\src_huffman.txt
目录 0 2011-05-20 16:56 Huffman
----------- --------- ---------- ----- ----
14800 14
- 上一篇:自然语言处理期末试卷2016年.docx
- 下一篇:多元回归分析程序
评论
共有 条评论