IUP Computer Science
CO 310 Spring 1986
Project #5
Write a Pascal program that sorts a group of student records
using a radix sort. The information for the student records is
contained in the file CO-STUDENTS.COMPSCI. This is NOT a file of
records; it is TEXT (a file of char). The lines in the file have
the student's name in columns 1-20, a blank, the course number in
columns 22-24, a blank, and the section number in columns 26-28.
Read the student information in and form a linked list with
nodes that have fields for name, course number, section number,
and a link. The key field for these student records is the name.
Run a radix sort that uses the first 8 characters of the name to
repeatedly group the nodes and place the groups in sequence until
the sort is finished.
Immediately before starting the sorting process, make a call
to the TIMER procedure and immediately after the sort is
finished, make another call to the TIMER procedure. TIMER
returns the system time measured in microseconds. Use the values
that come back from these two calls to calculate the execution
time of the sort (subtract the first time from the second time to
get an execution time in microseconds). To have access to TIMER,
put the following statement in your procedure declarations.
PROCEDURE TIMER (VAR TIME: INTEGER); EXTERNAL;
When your program is compiled, you will get a warning message
because EXTERNAL is not standard Pascal. Don't worry about this.
Also, when creating the run unit for your program, link the
object unit for your program with TIMER.COMPSCI, as in
!LINK your-object,TIMER.COMPSCI OVER run-unit
After the sort is finished, display the execution time.
Also, display the first 50 and last 50 complete student records
(name, course number, and section number). This list will
demonstrate that the sort works. Do NOT display all records;
there are too many (534 to be exact). Your program should work
properly for any number of records.
For comparison purposes, the execution times for this data
using the insertion sort (as shown in class) and the heap sort
(coming in the near future) are shown below.
Method Execution time in microseconds (number of records)
--------- --------------------------------------------------
Insertion 8,872,989 (534) 1,603,911 (200) 205,043 (50)
Heap 926,657 (534) 297,549 (200) 54,928 (50)