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.
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 1905:
Average speed: 5.5 km/h Sample stdev: 1.2
Eg no data:
March 1905: No Data
2. Average ambient air temperature and sample standard deviation for each month of a
specified year. (print on screen only)
Eg:
1905
January: average: 25.5 degrees C, stdev: 12.2 February: average; 27.5 degrees C, stdev: 10.1
March: No Data
3. sPCC that calculates sample Pearson Correlation Coefficient using either;
- Average Wind Speed (S) and Ambient Air Temperature (T). This is called S_T.
- Average Wind Speed (S) and Solar Radiation (R). This is called S_R.
- Ambient Air Temperature (T) and Solar Radiation (R). This is called T_R.
4. Average wind speed (km/h), average ambient air temperature and total solar radiation in kWh/m2 for each month of specified year. Standard deviation is printed in ( ) next to the average. (print to a file called “WindTempSolar.csv”)
Output Format:
Year, Month,Average Wind Speed(stdev), Average Ambient Temperature(stdev), sPCC
Eg:
1905 January,5.5(1.2),25.5(12.2),196.4
Values are comma separated
If data is not available for month, do not output month. If entire year’s data is not available, output just the year, “No Data”.
no data for a particular field, then output field is blank. e.g. temperature data is not available for feb 1905, output is:
February,4.5(3.1), ,200.3
5. Provide an option, which enables the reloading from the data/data_source.txt file. All previously loaded data is discarded, and heap memory released before reloading. This will enable program to keep running so that different combinations of data files can be used having to exit the program.
6. Exit the program
user specifies year and/or month as numeric values. Program asks in command line and the user types in the numeric values and presses “Enter” key. E.g. user types in 1 and not string January or Jan for first month of year.
user is not asked to enter a file name.
Processing:
The file data source. txt will contain the name of the input file that actually contains the data. it will be placed in a folder called data which also contains the csv files.The file data source.txt is hard coded into the program and this file will contain the name of the actual input data file (csv). Program must load data from the file name found in data source.txt. One data file is smaller than others and column arrangements are different. program should be able to read in any one with a change in file data _source. txt. Code should not require rebuilding if different input data file is needed.program must work with different arrangements of column data and it does not need to be rebuilt to read in a different input data file.
After loading the data into the required data structures (BST and STL Map), your program displays the menu to the user.
DATA STRUCTURES
Think of how you can use your BST with function pointers and the STL map (or STL map variants, which include multimap). Data structures can be used in many ways and so we want to know the thinking behind your choice of usage. Write down what you are thinking and the relevant theory you have used to guide your thinking. Consider the advantages/disadvantages of your approach and other potential approaches.
Hint: There are issues that you must resolve before you incorporate the BST and map data structures. You need to explain what you are trading-off and why.
Although not required, you can use STL data structures like stack, queue, linked list if they are wrapped in your own data structure classes. Only your BST and std::map (or variants) are mandatory data structures
Class declarations and implementations should be separated. Template classes would have the
implementation after the class declaration in the same header file.
You will need the following additional classes which you can implement however you want: Date, wind speed, ambient air temperature, Solar Radiation, and sPCC.
Step by step
Solved in 5 steps