Java program providing the user with a binary search tree implementation and manipulation menu. The user may
Question:
Java program providing the user with a binary search tree implementation and manipulation menu. The user may insert a new node (randomly created number), or delete a node, or opt to see all existing nodes whenever he wants. He may alternatively choose to terminate the program.
Sample output:
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:1
Value inserted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:1
Value inserted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:1
Value inserted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:1
Value inserted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:1
Value inserted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:2
Binary tree:
26 30 51 57 62
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:3
Which value to delete?99
26 30 51 57 62
Value not found.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:1
Value inserted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:1
Value inserted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:2
Binary tree:
0 26 30 51 57 62 91
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:3
Which value to delete?57
0 26 30 51 62 91
Value deleted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:3
Which value to delete?57
0 26 30 51 62 91
Value not found.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:3
Which value to delete?26
0 30 51 62 91
Value deleted.
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:2
Binary tree:
0 30 51 62 91
1-Insert 2-Show Tree 3-Delete Node 4-Exit. What's your choice:4
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss