Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Main{
- public static void main(String[] args) {
- BST_class bst = new BST_class();
- bst.insert(35);
- bst.insert(1);
- bst.insert(99);
- bst.insert(67);
- bst.insert(89);
- bst.insert(34);
- System.out.println("BST printed inorder:");
- bst.inorder();
- System.out.println("\nThe BST after Delete 99(leaf node):");
- bst.deleteKey(99);
- bst.inorder();
- System.out.println("\nThe BST after Delete 34 (node with 1 child):");
- bst.deleteKey(34);
- bst.inorder();
- System.out.println("\nThe BST after Delete 67 (Node with two children):");
- bst.deleteKey(67);
- bst.inorder();
- boolean ret_val = bst.search(89);
- System.out.println("\nKey 89 found in BST:" + ret_val );
- ret_val = bst.search(60);
- System.out.println("\nKey 60 found in BST:" + ret_val );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement