CPS 100E, Fall 1996 Inlab 11


Name:

Lab Section:


You should answer the following questions and either turn in the sheet during lab, or answer the questions when you submit your README file. These questions are worth 2 out of the 10 points for each lab. You don't need to get all the answers right to get the 2 points, but you must try.

It's ok to ask a UTA or TA for help, but first you must try to find the answers on your own.

  1. What is the third parameter passed to the MenuItem constructor? How is this value used in Testof useplace.cc (reproduced below) menu_g[k].function(map);



  2. Explain why the map that uses an unsorted vector takes much longer than a map that uses a Hash table to read in a file. Also give an answer in terms of Big Oh notation.



  3. Using the large database, what is the population of North Carolina?



  4. Why are the Distance and PrintState classes derived from the MapBase class? Explain in words, how the Apply member function of the map class knows to call the Function method in whatever class you send it (i.e., Distance or PrintState?)



  5. Describe briefly what the iterator code in the function DoCount is doing to count how many cities are in the database. Describe how this code could be modified to determine the population of all the cities in the data base or the population for only those cities in a given state (this doesn't use the class PrintState).