/** * runMergeSorts * * Creates a CensusData object and initializes it from the census * data file. Runs two sorts - one by population and one by city name - using * merge sort. * * @param fp File pointer to the census data file. */ void runMergeSorts(ifstream& fp) { timespec time1, time2; CensusData myCensusData; cout << endl << "**********MERGE SORT**********" << endl; myCensusData.initialize(fp); cout << endl << "Original Data" << endl; myCensusData.print(); clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1); myCensusData.mergeSort(myCensusData.POPULATION); clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2); cout << endl << "Sorted by POPULATION" << endl; printTime(myCensusData.getSize(), time1, time2); myCensusData.print(); clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time1); myCensusData.mergeSort(myCensusData.NAME); clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &time2); cout << endl << "Sorted by NAME" << endl; printTime(myCensusData.getSize(), time1, time2); myCensusData.print(); }