1 Star 0 Fork 0

莫念.莫言/20162329zxs_2ad

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
BinaryTree.java 1.67 KB
一键复制 编辑 原始数据 按行查看 历史
1050725105@qq.com 提交于 2017-10-22 23:06 +08:00 . 二叉树的实现
package chapter16;
//*******************************************************************
// BinaryTree.java Java Foundations
//
// Defines the interface to a binary tree collection.
//*******************************************************************
import java.util.ArrayList;
import java.util.Iterator;
public interface BinaryTree<T> extends Iterable<T>
{
// Returns the element stored in the root of the tree.
public T getRootElement() throws Exception;
// Returns the left subtree of the root.
public BinaryTree<T> getLeft() throws Exception;
// Returns the right subtree of the root.
public BinaryTree<T> getRight() throws Exception;
// Returns true if the binary tree contains an element that
// matches the specified element and false otherwise.
public boolean contains (T target) throws Exception;
// Returns a reference to the element in the tree matching
// the specified target.
public T find (T target) throws Exception;
// Returns true if the binary tree contains no elements, and
// false otherwise.
public boolean isEmpty();
// Returns the number of elements in this binary tree.
public int size();
// Returns the string representation of the binary tree.
public String toString();
// Returns a preorder traversal on the binary tree.
public ArrayList<T> preorder();
// Returns an inorder traversal on the binary tree.
public ArrayList<T> inorder();
// Returns a postorder traversal on the binary tree.
public ArrayList<T> postorder();
// Performs a level-order traversal on the binary tree.
public ArrayList<T> levelorder() throws Exception;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/XuiWe/20162329zxs_2ad.git
git@gitee.com:XuiWe/20162329zxs_2ad.git
XuiWe
20162329zxs_2ad
20162329zxs_2ad
master

搜索帮助