1 Star 0 Fork 0

CS-IMIS-23/20172307java

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BinaryTreeADT.java 2.11 KB
一键复制 编辑 原始数据 按行查看 历史
20172307tang 提交于 7年前 . 书上代码
package SecondTerm.week7;
import java.util.Iterator;
public interface BinaryTreeADT<T> {
/**
* 获取根部元素
*
* @return
*/
public T getRootElement();
/**
* 判断是否是空树
*
* @return true if this binary tree is empty, false otherwise
*/
public boolean isEmpty();
/**
* 返回树中元素的个数
*
* @return the number of elements in the tree
*/
public int size();
/**
*判定二叉树中是否存在当前的元素
*
* @param targetElement
* the element being sought in the tree
* @return true if the tree contains the target element
*/
public boolean contains(T targetElement);
/**
*在二叉树中查找响应的元素
*
* @param targetElement
* the element being sought in the tree
* @return a reference to the specified element
*/
public T find(T targetElement);
/**
*输出二叉树
*
* @return a string representation of the binary tree
*/
public String toString();
/**
*返回二叉树的迭代器
*
* @return an iterator over the elements of this binary tree
*/
public Iterator<T> iterator();
/**
* Returns an iterator that represents an inorder traversal on this binary
* tree.
*
* @return an iterator over the elements of this binary tree
*/
public Iterator<T> iteratorInOrder();
/**
* Returns an iterator that represents a preorder traversal on this binary
* tree.
*
* @return an iterator over the elements of this binary tree
*/
public Iterator<T> iteratorPreOrder();
/**
* Returns an iterator that represents a postorder traversal on this binary
* tree.
*
* @return an iterator over the elements of this binary tree
*/
public Iterator<T> iteratorPostOrder();
/**
* Returns an iterator that represents a levelorder traversal on the binary
* tree.
*
* @return an iterator over the elements of this binary tree
*/
public Iterator<T> iteratorLevelOrder();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/CS-IMIS-23/20172307java.git
git@gitee.com:CS-IMIS-23/20172307java.git
CS-IMIS-23
20172307java
20172307java
master

搜索帮助