Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write the following functions and add them to the genBST.h file supplied in the download link below. GenBST.h file is in the link http://s000.tinyupload.com/index.php?file_id=86544375185714297666. a)

Write the following functions and add them to the genBST.h file supplied in the download link below. GenBST.h file is in the link http://s000.tinyupload.com/index.php?file_id=86544375185714297666. a) We need a function to count the number of nodes in a binary tree. b) A function to count the number of leaves. Create a program that uses this class as follows (The tree is used store strings names). 1) The program should present the user with a menu as follows: 1. Add a new name 2. Delete a name 3. List the contents in ascending order 4. Display the number of nodes in the tree 5. Display the number of leafs 6. Exit the system Please enter your choice: 2. Create a function for each option on the menu to handle the request. 3. For choice # 1 (Add a new value), the function should prompt the user to enter a value (a string). If the value is already stored in the tree, you should display a message that indicates that. 4. For choice # 2 (Delete a value), the function should prompt the user to enter a value (a string). Display a message to indicate if the value is found and deleted or if it is not found. 5. Main() should call a function called menu() to display the menu and return users input. Main() should not handle any input or output other than reading and validating users input. 6. You need to submit the class files, main(), and the executable file. Note: The file downloaded from the publishers website contains a syntax error in deleteByCopying where a left ) is missing in "if (node->left== 0). Also, make sure to include using namespace std; and #include. Otherwise, the code does not compile.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

Verify the statement made in the remark following Example 10.2.

Answered: 1 week ago

Question

=+ 4. Why should policymakers think about incentives?

Answered: 1 week ago

Question

=+ 2. What is the opportunity cost of seeing a movie?

Answered: 1 week ago