$24
Assignment 4B include a programming portion and a written portion. The programming portion must compile and consist of a single le ( hw04B.cpp), and the type written portion should consist of a single le (hw04Bwritten) in a .pdf format. Be sure to include your name at the beginning of each le! You must hand in both les via NYU Classes.
Programming Part:
Enter data from the le MTA_train_stop_data.txt. The data from this assignment is from http://www.mta.info/developers/download.html. (Please note that we will only be using some of the information in this le for this assignment.1)
In the batch phase you will read all the data from the le called MTA_train_stop_data.txt into a container of type vector<trainStopData.
Your program will de ne the class trainStopData. It has the following private member variables :
string stop_id; string stop_name; double stop_lat; double stop_lon;
id of train stop (1st token)
name of station (4th token)
latitude of train stop location
longitude of train stop location
Your class should also have a constructor and the following public member functions:
string get_id( ) const
string get_stop_name( ) const
double get_latitude( ) const
double get_longitude( ) const
A bonus of %10 percent will be given if you turn in this homework assignment by Mon. Oct 10 at 11:00 p.m.
The data is in a common format; please read https://developers.google.com/transit/gtfs/reference?csw=1 for more information.
1
In this question you will write the code to determine if a vector contains duplicate items. Your function will return true if there are duplicates and false otherwise. You will solve this problem in four ways (i.e. you will write four functions).
Use the list class to help you nd the duplicates. (Use a "brute force" technique by comparing all items with each other.)
Use the STL sort algorithm, and the vector class to help you nd the duplicates
Use the set class to help you nd duplicates
Use the unordered set class to help you nd duplicates
Written Part
In programming question 2, what are the average case and the worst case running times for each of the di erent ways you used to nd duplicates? Write your answers using big-Oh notation.
2