Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

need c++ format Assignment Implement a Binary Search Tree given the code given below. Most of the functionality is given however you will need to

need c++ format

image text in transcribedimage text in transcribedimage text in transcribed

Assignment Implement a Binary Search Tree given the code given below. Most of the functionality is given however you will need to implement the following void BST BST* subtree) Should completely erase the tree recursively BSTNode BST #include template template BSTNode delete data; ) K getKey) const return key: h DatacT>getData) const freturn data; ) void setLeft (BSTNode K,T* const node) left- node; void setRight(BSTNodeK,T>* const node) { right node; } BSTNode& rhs) const return key * left = nullptr; BSTNode& operator-(const BSTNode6) -delete ; template bool remove (const K& key) // Implement remove node EST() { destroy(root); } BSTNode K,T* rootnullptr template * BST* subtree) template void BSTK, Trint (std::ostream& outfile, const BSTNode T,subtree) const template typename K, typename bool BSTK, T> : : remove (const K& key) { template typename typename BSTNodeK,T BSTK,Tsearch(const K& key) nain.cpp #include "BST.h" int main BSTint,int> tree: tree.add(50, 50) tree.add (40, 40); tree. add(60, 60); tree.add(55, 55); tree.print(); return O 0

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

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

ISBN: 1844804526, 978-1844804528

More Books

Students also viewed these Databases questions