CSE326 Winter 2002 Quiz Section

GROUP WORK: Discussion for 2/14/02

 

Briefly discuss the approach you would take to the following programming scenarios.  Make any assumptions you need to.

 

1.      You have been given a file of all UW CSE undergraduates with their names and GPAs in alphabetical order by their names.  Your task is to sort the students by their GPAs (note that if two students have the same GPA, they should then be sorted by their names).  How will you do this?

 

What if you were asked to do this for the entire undergraduate body of the UW system?

 

2.      The system you are designing requires a sort routine.  Unfortunately, memory usage is at such high cost on this machine that you cannot afford to have much (if any overhead) in your sorting algorithm.  What do you do?

 

3.      You are working with a large set of data, say a listing of nodes on a network and the traffic they experience, that is originally in random order.  On semi-regular occasions, the values of particular items could change.  For example, item X could have its value change from 3 to 70.  You need to be able to find these items and update these values rapidly. How would you do this?

 

4.      You have a large, singly-linked list that needs to be sorted.  How would you do this efficiently?

 

5.      You are the manager of a collection of data that keeps track of the current graduate students in the department.  David Notkin wants the data sorted in alphabetical order.  Each night, you receive a list of new grad students that have been admitted, as well as a list of students who perished while stoking the furnace of the steam-powered turing machine.  David is monitoring your computer usage, so your code better handle this batch insertion and deletion as efficiently as possible.  How will you keep David happy?