-
Notifications
You must be signed in to change notification settings - Fork 104
/
Copy pathTree.java
46 lines (37 loc) · 912 Bytes
/
Tree.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package ch_25;
public interface Tree<E> extends Iterable<E> {
/**
* Return true if the element is in the tree
*/
public boolean search(E e);
/**
* Insert element e into the binary search tree.
* Return true if the element is inserted successfully.
*/
public boolean insert(E e);
/**
* Delete the specified element from the tree.
* Return true if the element is deleted successfully.
*/
public boolean delete(E e);
/**
* Inorder traversal from the root
*/
public void inorder();
/**
* Postorder traversal from the root
*/
public void postorder();
/**
* Preorder traversal from the root
*/
public void preorder();
/**
* Get the number of nodes in the tree
*/
public int getSize();
/**
* Return true if the tree is empty
*/
public boolean isEmpty();
}