USING C++ Implement a simple (non-templated) Binary Search Tree (BST) class called intBst, which stores integers. Provide the following recursive operations: Insert, Delete tree, Search, inOrder traversal, preOrder traversal, postOrder traversal. Would Delete tree be public or private? Methods that are essential for the correct operation of the tree in terms of managing memory must be provided. You should go through the lecture notes (and the textbook for ideas).
Processing a node simply involves printing out the contents of the node, which in this case is the integer stored in the node.
Data should come from a data file containing integers. You decide on the format. The main program should open the data file and insert into the tree and demonstrate other tree operations.
The point of this exercise is to demonstrate that you understand the BST. There is no need to go overboard with it and put in operations not asked for that you will normally find in the textbook and the reference book, Introduction to Algorithms.
class intBst{… //intBST.h
/// declaration of methods and data members of class intBst with doxygen
comments };
// The implementation can go into intBST.cpp but for convenience only, keep the
// rest of the code in intBST.h with normal (non-doxygen) code comments
// The integer BST will be changed later to a template BST, and that is the reason
// for having everything in inBST.h now – convenience for the changeover to
// template BST.
To use your BST in your test program, you will have the following declaration in the main program’s routine main().
intBst intTree; // declaration of non-templated integer tree
// other code follows the above:
// insert various integer values
// test the tree methods
Make sure that the BST is tested properly. So that would involve passing it to subroutin

Step by stepSolved in 3 steps with 2 images

- USING C++, Implement a TEMPLATED Binary Search Tree (RECURSIVE) class, that is minimal & complete. Provide the following recursive operations: Insert, Delete tree, Search, inOrder traversal, preOrder traversal, postOrder traversal. Methods essential for correct operation of tree in terms of managing memory must be provided. Any additional methods can be added. Use function pointers in the traversal routines. cannot use std::function (or any other similar routine from std namespace. Test BST to make sure all methods work. In particular make sure that you can pass the tree to other routines by value, const reference and reference. Check that data values are as expected on pass/return to/from routines. Do not use GUI interaction. Input/Output (user): Sample output formats shown below use made up data for the year 1905. Menu options are: The average wind speed and sample standard deviation for this wind speed given a specified month and year. (print on screen only) Eg: January…arrow_forwardImplement the pre-order tree traversal algorithm in C++. This program should use the following binary tree (see image) and display the pre-order tree traversal of the nodes’ values. Feel free to write this iteratively or recursively. Also, explain how it works and how a new tree could be provided to the code. PS: make sure that the logic of the program is correct, meaning that it can work well with different binary trees. I would like to change the tree input to the pre-order traversal function. The program should work errorless and display the result correctly. No need to code it to read the user input, however, provide instructions on how a new tree can be defined in this program to check if the program works fine with different trees.arrow_forward24. Add the following new method in the BST class. /** Returns the number of nodes in this binary tree */ public int getNumberofNodes () Requirements: a. Don't use return size; b.write a recursive method that returns the number of nodes starting from www the root.arrow_forward
- Can help in Java? Qustion : Using Binary search tree write a Java program to Insert and print the element in (in-Order traversal ), then search the elements (a and z) in the tree… provided that user enters the values.arrow_forwardI need help with coding in C++ please: Write a program (in main.cpp) to do the following: a. Build a binary search tree T1. b. Do a postorder traversal of T1 and, while doing the postorder traversal, insert the nodes into a second binary search tree T2 . c. Do a preorder traversal of T2 and, while doing the preorder traversal, insert the node into a third binary search tree T3. d. Do an inorder traversal of T3. e. Output the heights and the number of leaves in each of the three binary search trees. The program should accept input and produce output similar to the example below: Enter numbers ending with -999: 10 5 7 -999 tree1 nodes in postorder: 7 5 10 tree2 nodes in preorder: 7 5 10 tree3 nodes in inorder: 5 7 10 tree1 height: 3 tree1 leaves: 1 tree2 height: 2 tree2 leaves: 2 tree3 height: 2 tree3 leaves: 2 The program has 3 tabs: main.cpp , binarysearchTree.h , and binaryTree.harrow_forwardAssume we have an IntBST class, which implements a binary search tree of integers. The field of the class is a Node variable called root that refers to the root element of the tree. 1) Write a recursive method for this class that computes and returns the sum of all integers less than the root element. Assume the tree is not empty and there is at least one element less than the root. 2) Write a recursive method that prints all of the leaves, and only the leaves, of a binary search tree. 3) Write a method, using recursion or a loop, that returns the smallest element in the tree.arrow_forward