Question: Problem 2 : Choose a single existing data structure implementation * not including the list data structure implementations ( i . e . your options
Problem : Choose a single existing data structure implementation not including the list data structure implementations ie your options are, most likely, ArrayStack, CLQueue, BST Heap from class. You are to write a C program that will
i pts read your dataset from part of the project or you can choose a new one, if preferred into your chosen structure, and
ii pts print a subset of rowsrecords from your dataset in response to user input. I will be flexible with the latter, but the user must be able to provide an input value that changes what elements of your data are printed. Some ideas are below you can use any of these, modify them, or come up with your own:
a Print out elements of a BST with a chosen attributecolumn that exceeds a certain value ex: for the CCFraud data only rows with more than an input value for amount.
b Print out elements from a PQ heap matching the k highest or k lowest where k is a value input by the user values for a chosen attributecolumn
c Print out every kth element loaded into a CLQueue again where k is a value input by the user
Note: you will likely want to consult andor modify the main.cpp file you used in part or create one, if you did not finish! to handle the reading of data into the structure, as well as writing of it But remember you will also need to modify the new data structure you have chosen, which includes details such as modifying or removing other operations ex: there is likely no need to keep DeleteItem for the BST and you can potentially even discard the traversals and traversal queue if you like
#include "ASListR.h
#include
#include
#include
using namespace std;
ASListR csvtoASListRstring csvfileconvert a csv file to a list structure
ASListR retCCList; Make sure the array has sufficient size for our data
ifstream ReadFilecsvfile; open the csv file for reading
string line, curvalue;
getlineReadFile line; throw away the first line column names
while getlineReadFileline
stringstream ssline; turn the line into a stringstream
int fielditer;
cpus newrec;
whilegetliness curvalue, Separate each variable per sample from the comma separator
switch fielditerWe need to explicitly convert values to the appropriate type stoiinteger, stoddouble
case : newrec.Processstoicurvalue; break;
case : newrec.Coresstodcurvalue; break;
case : newrec.Codenamestoicurvalue; break;
fielditer;
retCCList.PutItemnewrec;
return retCCList;
int mainint argc, char argv
ASListR cpucsvtoASListRcpucsv;
cpu.PrintList; Print the data to make sure they are correct order in this case, in decreasing order by cost
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
