Fall 2001 CSCI 333 Homework 8

This assignment is due Friday, 30 November.

Problem 1

Consider the following C record:


  struct city {
    char Name[80] ;
    char State[2] ;
  }

Show how you would use the C/C++ qsort routine to sort 3000 of these city records stored in an array. You must sort the cities, first by State and then by Name within the state. For example, the record for Atlanta, GA, should appear in the array before the record for Asheville, NC.

You do not need to write a complete program to implement this question, but you should provide at least the following:

Problem 2

Do textbook problem 9.14 (page 323).

Problem 3

What is the 32-bit number generated by running ELFhash (page 306) on the string "UNCA".