Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In C++ implement insert() in the following code and show the results of inserting 2, 1, 4, 5, 9, 3, 6, 7, 10, 12, 11

In C++ implement insert() in the following code and show the results of inserting 2, 1, 4, 5, 9, 3, 6, 7, 10, 12, 11 into an empty Binary search tree. Start with this tree and implement delete_node() and delete 4 then delete 9. Using this code with the deleted nodes, implement search() and search 12 then search 4.

image text in transcribed

I can get the nodes inserted but something is wrong when I delete because it says that 4 is found when it shouldn't after it is deleted.

#include #include using std::cout; using std::endl; class Node { int value; public: Node* left; Node* right; Node* p; // left child // right child // parent Node (int data) { value = data; left = NULL; = NULL; right = NULL; ~Node () { int d() { return value; void print() { std::cout

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 Design Application Development And Administration

Authors: Michael V. Mannino

3rd Edition

0071107010, 978-0071107013

More Books

Students also viewed these Databases questions

Question

What is meant by organisational theory ?

Answered: 1 week ago

Question

What is meant by decentralisation of authority ?

Answered: 1 week ago

Question

Briefly explain the qualities of an able supervisor

Answered: 1 week ago

Question

Define policy making?

Answered: 1 week ago

Question

Define co-ordination?

Answered: 1 week ago

Question

Identify cultural barriers to communication.

Answered: 1 week ago