CIS 067.001

Assignment 8 F2001

Linked Lists

Reading: We are now looking at Part I in the Syllabus. Read Chapter 13 (Sections 13.1-13.5 -- NOT Chapter 14 as indicated in the Syllabus) in the Friedman/Koffman text Part I.

Assignment:

Consider the following node structure
 
    struct sn_type  { // student node struct
        string fname; // first name of student
        string lname; // last name of student
        int dob;      // date of birth of student, mmdd19yy
        sn_type fptr; // forward pointer (to next node in the list)
        sn_type bptr; // backward pointer (to previous node in list)
    }

Write a program to do the following:

  1. While not eof:
    1. Read a record of data from a stream, where each record contains the first name, last name, and date of birth for each student in our class.
    2. Create a new node of type sn_type containing the information just read.
    3. Insert the node into the linked_list dll (double linked list) of type dll_type so as to maintain ascending order by last name.
  2. Display the contents of the list (one line of output per list node) and a count of the number of elements in the list, with the last name of the student coming first, followed by a comma, the first name of the student, and then the date of birth of the form mm/dd/19yy.

Test your program on the following data (date of birth made up):

Uchechukwu Ofoegbu 12091942
Dawad Alexander 12251989
Neil Gallagher 08261972
Kasaija Mugenyi 02121901
Joshua Rucker 05101921
Christian Archbold 06061962
Manjeet Singh 03301912
James Creevey 06101968
Erik Walschburger 04181915
Roman Zelfon 06111950
Joseph Magee 02221901
Albert Dangelantonio 08011975
Louis Gregory 01011991