Write a program in C++ to create a Binary Search tree (BST) of string data. The program will perform these operations: Insert name(s), Traverse Preorder, Search name, Delete name, Leaf Count, sibling of a person and Quit.
(please answer the question in c++ i need the nodes to be able to accept strings like "KIM" used in the example)
Option 4: Deletes a name from the BST.
It will prompt: Enter name you want to delete: TOM
If the name is found then delete the name from the BST and displays the message –“___ is deleted.” If the name is not in the BST, then it will display – “____ is not found in the BST”
TOM is deleted
Option 5: Counts the number of leaves in the BST and displays –
“There are ____ number of leaves in the BST.”
Option 6: Enter a name and it will display the sibling of that person.
It will prompt: Enter the name you want to find the sibling of:
The sibling of ____ is _____
If the person has no sibling, then it displays:
____ has no sibling.
Ex: Enter the item: PAM
The sibling of PAM is DON.
Option 7: Quit the
Trending now
This is a popular solution!
Step by step
Solved in 2 steps