Question: LAB -8 Binary Search Tree Q1. a) Write a C++ program to implement a Binary Search tree (do not use structures). Your program should accept

 LAB -8 Binary Search Tree Q1. a) Write a C++ program

LAB -8 Binary Search Tree Q1. a) Write a C++ program to implement a Binary Search tree (do not use structures). Your program should accept a list of numbers from the user (minimum5) and then build a binary search tree from those numbers. Also, implement a search function that takes one value as an argument and prints whether or not the number was found in the list. Define three files: bst.h, bst.cpp and your main.cpp to test your code. Use the given code at the end to create the Binary Search Tree b) Write the definition of the function, leavesCount, that returns the number of leaves in a binary tree c) Print the contents of your tree using inorder traversal. You may use Stack STL if needed [TOTAL: 15 points] class Node int info; public: Node (int info); int getInfo void setInfo(int value); Node left, *right; class BST Node *root; public: BST () BST void insert (int); void/bool search (int)I/you can either make it void or bool void inorderTraversal(); void/int unt(); NOTE:- Please submit a single PDF/Word file containing all your code. Do not take the screenshot of your code. Only the screenshot of output is allowed. The code should be pasted as a text. Add comments where necessary LAB -8 Binary Search Tree Q1. a) Write a C++ program to implement a Binary Search tree (do not use structures). Your program should accept a list of numbers from the user (minimum5) and then build a binary search tree from those numbers. Also, implement a search function that takes one value as an argument and prints whether or not the number was found in the list. Define three files: bst.h, bst.cpp and your main.cpp to test your code. Use the given code at the end to create the Binary Search Tree b) Write the definition of the function, leavesCount, that returns the number of leaves in a binary tree c) Print the contents of your tree using inorder traversal. You may use Stack STL if needed [TOTAL: 15 points] class Node int info; public: Node (int info); int getInfo void setInfo(int value); Node left, *right; class BST Node *root; public: BST () BST void insert (int); void/bool search (int)I/you can either make it void or bool void inorderTraversal(); void/int unt(); NOTE:- Please submit a single PDF/Word file containing all your code. Do not take the screenshot of your code. Only the screenshot of output is allowed. The code should be pasted as a text. Add comments where necessary

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!