Schedule Lab, Using a Sparse Matrix

Sometimes a matrix is the logical data structure to store data that can be indexed in two ways. Suppose you had to design and maintain a schedule that holds information about students (the columns) and courses (the rows) in a new school. Because the school is new, it has only a few course offerings and a small student body. The table below shows that the schedule matrix is very sparsely filled. Sparsely filled arrays and matrices can be implemented by arrays of pointers to save memory. The diagrams will help you visualize how to implements this scheduling program with a dynamic data structure.

Suppose you have the following data:
Courses (3 digits)
121 Economics
112 Writing_Seminar
103 Voice
128 Algorithm_Analysis
105 Music_Theory
125 Calculus
107 Orchestral_Arranging
129 Compiler_Design
109 Piano
119 English_Literature
Students (2 digits)
14 Melody_Smith
17 Richard_Tucker
27 Beverly_Sills
16 Charles_Ives
18 Richard_Schumann
15 Franz_Lizst
28 Aaron_Copeland
29 Bill_Gates
Scheduling
29 129 128
28 107 105
18 109 105
15 109
16 107
27 103
17 103
14 109 103

Design a dynamic data structure which will hold and display the following. Implement it in a program that manages the scheduling for a small school.


Continue to:  Unit 6  / Prev  / Next