1 Star 0 Fork 0

WJH/wjh20162327_datastructure

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
LinkedBinaryTreeTest.java 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
WJH 提交于 2017-10-24 07:37 +08:00 . 十六章的树
package Tree;
import Tree.*;
/**
* Created by Administrator on 2017/10/23/023.
*/
public class LinkedBinaryTreeTest { //参考张旭升代码后自己完成的测试
public static void main(String[] args) {
LinkedBinaryTree<String> current = new LinkedBinaryTree<String>("A");
//current.root = new BTNode<String>("A");
BTNode<String> a = current.root;
a.left = new LinkedBinaryTree<String>("B").root;
a.right = new LinkedBinaryTree<String>("C").root;
(a.left).left = new LinkedBinaryTree<String>("D").root;
(a.left).right = new LinkedBinaryTree<String>("E").root;
(a.right).left = new LinkedBinaryTree<String>("F").root;
(a.right).right = new LinkedBinaryTree<String>("G").root;
System.out.println(current.isEmpty());
try {
System.out.println(current.contains("A"));
System.out.println(current.contains("H"));
} catch (Exception e) {
e.printStackTrace();
}
ArrayIterator<String>Iterator = (ArrayIterator<String>) current.preorder();
System.out.println("先序遍历:");
for(String i :Iterator){
System.out.println(i);
}
ArrayIterator<String>Iterator2 = (ArrayIterator<String>) current.postorder();
System.out.println("后序遍历:");
for(String i :Iterator2){
System.out.println(i);
}
System.out.println("中序遍历:" + current.toString());
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/WwJjHh/wjh20162327_datastructure.git
git@gitee.com:WwJjHh/wjh20162327_datastructure.git
WwJjHh
wjh20162327_datastructure
wjh20162327_datastructure
master

搜索帮助