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
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
Step by Step Solution
There are 3 Steps involved in it
The detailed answer for the above question is provided below Answer Heres a Java program that implements a binary search tree with the provided menu f... View full answer
Get step-by-step solutions from verified subject matter experts
