Lab 10 - Linked Lists
- Generate and use a linked list.
- Demonstrate it by storing a list of student classes for
- Read Chapter 13 in the 7th edition of the Hanly/Koffman text (or Chapter 14 in the 6th or 5th edition).
BY MIDNIGHT ON 04/26/2013)
- Submittal of the following files:
- This time we will accept
incomplete assignments. So even if you did not complete the lab (e.g. you
cannot compile your code, or it throws segmentation errors) - submit your files
for a partial credit!
NOTE: YOU DO NOT NEED TO TURN IN YOUR DATA FILES!
TO DO (for this
- Design and Write a program to solve Programming Project
#7 on page 760 in the 7th edition of
the Hanly/Koffman text (or on page
771 in the 6th edition, or on page 757 of the 5th edition).
- Be sure your Makefile will
properly rebuild the run image.
- Be sure that your array (or list...) of students is
built in sorted order (the data structure, you choose to record students,
needs to be ordered based on increasing student ID number) no matter how
the input is provided (e.g. the list of students in your input file may be
- Have a AddNode function and a DelNode function for your linked lists
of students' classes.
- Write as many other functions as you need to. (Such as
FindBefore (for adding) and FindNode (for deleting), etc.)
- Keep the courses for every student in order also.
Order your list by course numbers. Assume all of the courses
to be "CS".
- This means when you add
a node, you may have to add it at the front, middle, or end of the list
(i.e. wherever it needs to be added), to keep the list in proper order
(based on course number).
- You will use ascii
data files with hard coded file names for this laboratory.
- Build your sample input
files with a text editor.
- Edit your sample output
files with a text editor to verify functionality.
- Inputs: a data file named Lab10InputData in the following
- The number of students
- A list of student id
- The number of classes
(i.e. student-for-class registrations) to add
- A preliminary list of
class data (one student-for-class registration per line) with: (1)
student id, (2) class id, (3) section #, and (4) number of credits.
- The number of
modifications to the list
- And finally a list of
modifications to the list, with additions and deletions specified one per
line. A three letter code ("del" or "add") followed
by the student id number and the class id. (For adds
there will also be a section number and a number of credits.)
- A sample set of data
6 ¬ (number of students)
1001 1005 1008 1019 1021 1032 ¬ (student ids)
4 ¬ (number of initial classes)
1008 CS221 1 3 ¬ (student id, class id, sec,
1001 CS222 2 3 ¬ (student id, class id, sec,
1032 CS201 1 3 ¬ (student id, class id, sec,
1001 CS350 1 3 ¬ (student id, class id, sec,
2 ¬ (number of modifications)
del 1008 CS221 ¬ (a deletion)
add 1032 CS324 3 4 ¬ (an addition)
- Outputs: a data file named Lab10OutputReport with the following:
- After the original list
is built, a formatted output of the total data structure (i.e. whole list
of all classes for every student).
- After the modifications
(i.e. additions and deletions) are registered, another formatted output
of the total data strucure.
An example output for the above input follows:
: CS222 2 3
CS350 1 3
1008 : CS221 1 3
1032 : CS201 1 3
1001 : CS222 2 3
: CS350 1 3
1032 : CS201 1 3
: CS324 3 4
(analyze these files):