Programming Assignment 2
Create the BST below by inserting nodes in the correct order to give the tree structure below:
Write two find methods that takes one int parameter, which will be the value to search for. The method returns a pointer to the node containing the value if the value is found, and returns a null pointer otherwise.
One method, find1, will use iteration (not recursion).
The second method, find2, will call a private helper method also named find2 that takes two parameters, the int to search for, and the root node of a sub-tree to search in. The private method will be recursive.
Make the methods print what they are doing as follows:
If the current node is null, print 'Not Found', if the value is found at the current node, print 'Found', if the current node contains a value not equal to the value searched for, print the value at the current node, and print 'Searching Left' or 'Searching Right', depending on which sub-tree the function will look in next.
For example, for the tree diagrammed above, t.find1(30); should print:
40 Searching Left
20 Searching Right Found
Download and run the program BST_03.cpp
DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of