-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBSTTest.java
More file actions
22 lines (21 loc) · 604 Bytes
/
BSTTest.java
File metadata and controls
22 lines (21 loc) · 604 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.al;
public class BSTTest {
public static void main(String[] args) {
BST bst = new BST();
BST.Node root = bst.new Node(33);
int[] arr = {16,50,13,18,34,58,15,17,25,51,66,19,27,55};
for (int i1 : arr) {
bst.insert(root, i1);
}
bst.preOrder(root);
System.out.println("delete nodes ===========");
try {
bst.delete(root, 13);
bst.delete(root, 18);
bst.delete(root, 55);
} catch (Exception e) {
e.printStackTrace();
}
bst.inOrder(root);
}
}