1 Star 1 Fork 0

CS-IMIS-23/20172313yukunpeng

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
BinaryTreeADT.java 2.57 KB
一键复制 编辑 原始数据 按行查看 历史
余坤澎 提交于 7年前 . 二叉树ADT
package srcNo16.TextbookCode.jsjf;
import java.util.Iterator;
/**
* BinaryTreeADT defines the interface to a binary tree data structure.
*
* @author Lewis and Chase
* @version 4.0
*/
public interface BinaryTreeADT<T>
{
/**
* Returns a reference to the root element
*
* @return a reference to the root
*/
public T getRootElement();
/**
* Returns true if this binary tree is empty and false otherwise.
*
* @return true if this binary tree is empty, false otherwise
*/
public boolean isEmpty();
/**
* Returns the number of elements in this binary tree.
*
* @return the number of elements in the tree
*/
public int size();
/**
* Returns true if the binary tree contains an element that matches
* the specified element and false otherwise.
*
* @param targetElement the element being sought in the tree
* @return true if the tree contains the target element
*/
public boolean contains(T targetElement);
/**
* Returns a reference to the specified element if it is found in
* this binary tree. Throws an exception if the specified element
* is not found.
*
* @param targetElement the element being sought in the tree
* @return a reference to the specified element
*/
public T find(T targetElement);
/**
* Returns the string representation of this binary tree.
*
* @return a string representation of the binary tree
*/
public String toString();
/**
* Returns an iterator over the elements of this tree.
*
* @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/20172313yukunpeng.git
git@gitee.com:CS-IMIS-23/20172313yukunpeng.git
CS-IMIS-23
20172313yukunpeng
20172313yukunpeng
master

搜索帮助