forked from iamsh4shank/phone_directory
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBST.java
More file actions
29 lines (23 loc) · 643 Bytes
/
BST.java
File metadata and controls
29 lines (23 loc) · 643 Bytes
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
package phone_directory;
import phone_directory.BSTNode;
import phone_directory.DirectoryModel;
import phone_directory.PhoneDirectory;
class BST {
BSTNode root;
public void insert(DirectoryModel directoryModel) {
if (root == null) root = new BSTNode(directoryModel);
else root.insert(directoryModel);
}
public void inorder() {
if (root == null) return;
else root.inorder();
}
public void display() {
if (root == null) return;
else root.display();
}
public void search(String name) {
if (root == null) return;
else root.search(name);
}
}