Write a program using c++ to implement a character-based Binary Search Tree (BST). Each node in the BST should be store student name (string) as follows: class Node{// node prototype public: char ch;// this letter is taken from student first letter string studentName; Node *leftChild; Node *rightChild; }; For example, if a student’s name is Adam then ch will be equals to A. If the student’s name is Lee then ch will be equal to L. The insertion of a node to the BST is based on the first letter of the student name. Your program should display the following: 1. Insert a node (base on ch) 2. Find a node (base on student name) 3. Delete a node (consider all three cases of delete) 4. Exit
- Write a program using c++ to implement a character-based Binary Search Tree (BST). Each node in the BST should be store student name (string) as follows:
class Node{// node prototype
public:
char ch;// this letter is taken from student first letter
string studentName;
Node *leftChild;
Node *rightChild;
};
For example, if a student’s name is Adam then ch will be equals to A. If the student’s name is Lee then ch will be equal to L.
The insertion of a node to the BST is based on the first letter of the student name.
Your program should display the following:
1. Insert a node (base on ch) 2. Find a node (base on student name) 3. Delete a node (consider all three cases of delete) 4. Exit
|
Step by step output:
------------------------------------------------------------------------------------------------------------
- Insert a node (base on ch)
- Find a node (base on student name)
- Delete a node (consider all three cases of delete)
- Exit
in the picture
and Output/results provided and explain the
![Please select an operation: 1
Please input a name: Lee
Display tree
1. Insert a node (base on ch)
2. Find a node (base on student name)
3. Delete a node (consider all three cases of delete)
4. Exit
Please select an operation: 1
Please input a name: Adam
Display tree
L
A
1. Insert a node (base on ch)
2. Find a node (base on student name)
3. Delete a node (consider all three cases of delete)
4. Exit
Please select an operation: 1
Please input a name: Michele
Display tree
M
A](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4bf9c5f1-b2c9-4d91-952f-63497f8b9557%2Fd974e97d-13f1-4986-b47a-888d9a9880e5%2Fjp0t85_processed.png&w=3840&q=75)
![1. Insert a node (base on ch)
2. Find a node (base on student name)
3. Delete a node (consider all three cases of delete)
4. Exit
Please select an operation: 3
Specify the node you want to delete: Adam
Display tree
M
1. Insert a node (base on ch)
2. Find a node (base on student name)
3. Delete a node (consider all three cases of delete)
4. Exit
Please select an operation: 2
Please input a name: Adam
Not found
1. Insert a node (base on ch)
2. Find a node (base on student name)
3. Delete a node (consider all three cases of delete)
4. Exit
Please select an operation: 4
Exit](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F4bf9c5f1-b2c9-4d91-952f-63497f8b9557%2Fd974e97d-13f1-4986-b47a-888d9a9880e5%2Fnrovho_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)