Design a Binary Search Tree ADT by using following functions. Include the function definitions & run the program (Kindly include header files as well). Paste the output as a screenshot and write the code in your answer sheet. insert(int val) find(int x) ************************************************************************************ class btNode { public: int info; btNode *lLink; btNode *rLink; btNode(int e, btNode *l = NULL, btNode *r = NULL) { info = e; lLink = l; rLink = r; } btNode() { lLink = NULL; rLink = NULL; } }; class binarySTADT { private: btNode *root; int count = 0; public: binarySTADT() { root = NULL; } void insert(int val); // function to insert a given value in the tree. bool find(int); // function to check if at-least one instance of a given value exists in the binary tree }; ****Write your function definition here**** int main() { binarySTADT bt1; cout << "Testing the BST implemetation: Empty Tree created" << endl; bt1.insert(10); bt1.insert(12); bt1.insert(37); bt1.insert(8); bt1.insert(-1); bt1.insert(-6); cout << "Search for 45: " << bt1.find(45) << endl; cout << "Search for 37: " << bt1.find(37) << endl; cout << "Search for -1: " << bt1.find(-1) << endl; }
1.) Design a Binary Search Tree ADT by using following functions. Include the function definitions & run the program (Kindly include header files as well). Paste the output as a screenshot and write the code in your answer sheet.
insert(int val)
find(int x)
************************************************************************************ class btNode
{ public:
int info; btNode *lLink;
btNode *rLink;
btNode(int e, btNode *l = NULL, btNode *r = NULL)
{
info = e; lLink = l;
rLink = r;
}
btNode()
{
lLink = NULL;
rLink = NULL;
}
};
class binarySTADT
{ private:
btNode *root; int count = 0; public:
binarySTADT()
{
root = NULL;
}
void insert(int val); // function to insert a given value in the tree.
bool find(int); // function to check if at-least one instance of a given value exists in the binary tree };
****Write your function definition here****
int main()
{
binarySTADT bt1;
cout << "Testing the BST implemetation: Empty Tree created" << endl; bt1.insert(10); bt1.insert(12); bt1.insert(37); bt1.insert(8); bt1.insert(-1); bt1.insert(-6);
cout << "Search for 45: " << bt1.find(45) << endl; cout << "Search for 37: " << bt1.find(37) << endl; cout << "Search for -1: " << bt1.find(-1) << endl;
}
![Desired output
Testing the BST implemetation: Empty Tree created
Search for 45: 0
Search for 37: 1
Search for -1: 1](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F611e1a3b-9160-4022-b1ef-7a32dd7cfdbb%2F4acca090-a217-4f18-8dd4-e600f3c2026b%2Fu35cq8s_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 3 steps with 6 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)