Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please provide the class in C++ and follow the instructions provided. I want a *.h file and a *.cpp file separtely. (40 points) Implement a

image text in transcribed

Please provide the class in C++ and follow the instructions provided. I want a *.h file and a *.cpp file separtely.

(40 points) Implement a binary search tree class capable of storing integers. There are two points of ambiguity: In the case where an inserted value is already present in the tree, insert to the left. In the case where a deleted value has two internal children, seek the minimum value in the right subtree to replace the deleted value (40 points) Using your binary search tree class, implement a program that transforms its input as follows Read a sequence of lines. Each line will have one of the following forms insert N or delete N where N is an integer value. Insert or delete that integer as indicated After reading all input, implement a function (e.g., level-print) to print the tree to the output level by-level. That is, print the root on one line, followed by the two nodes (from left to right) at level 1 on the second line, followed by the (up to) four nodes at level 2 on the next line, etc. For example, given the following input: nsert 5 insert 20 insert 3 insert 4 insert 9 delete 4 insert 7 The program will produce this output 3 20 7 9 Hint: the level-by-level output involves a breadth-first traversal of the tree, which can be implemented use a queue. You can use standard queue interface or library in java and c++

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

Step: 3

blur-text-image

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

Database Systems Introduction To Databases And Data Warehouses

Authors: Nenad Jukic, Susan Vrbsky, Svetlozar Nestorov

1st Edition

1943153191, 978-1943153190

More Books

Students also viewed these Databases questions