-
Notifications
You must be signed in to change notification settings - Fork 0
/
AVLTreeADT.java
57 lines (48 loc) · 1.37 KB
/
AVLTreeADT.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
46
47
48
49
50
51
52
53
54
55
56
57
/**
* Filename: AVLTreeADT.java
* Project: p2
* Authors: Debra Deppeler
*
* DO NOT EDIT THIS INTERFACE
*/
import java.lang.IllegalArgumentException;
public interface AVLTreeADT<K extends Comparable<K>> {
/**
* Checks for an empty AVL tree.
* @return true if AVL tree contains 0 items
*/
public boolean isEmpty();
/**
* Adds key to the AVL tree
* @param key
* @throws IllegalArgumentException if key is already in the AVL tree or null value inserted
*/
public void insert(K key) throws DuplicateKeyException, IllegalArgumentException;
/**
* Deletes key from the AVL tree
* @param key
* @throws IllegalArgumentException if try to delete null
*/
public void delete(K key) throws IllegalArgumentException;
/**
* Search for a key in AVL tree
* @param key
* @return true if AVL tree contains that key
* @throws IllegalArgumentException if searching for a null value
*/
public boolean search(K key) throws IllegalArgumentException;
/**
* Prints AVL tree in in-order traversal.
*/
public String print();
/**
* Checks for the Balanced Search Tree.
* @return true if AVL tree is balanced tree
*/
public boolean checkForBalancedTree();
/**
* Checks for Binary Search Tree.
* @return true if AVL tree is binary search tree.
*/
public boolean checkForBinarySearchTree();
}