IUP Computer Science
CO 310 Spring 1986

Project #3



    For each of the following problems, write the most efficient procedure you can devise.  Efficiency will be one aspect of the grading.  You are expected to work on these problems by yourself.   If you have questions or need clarification, talk to the professor.  Do NOT make assumptions about the problems without clearing them with the professor.  PLEASE WRITE CLEARLY AND USE 8 1/2 by 11 PAPER.


1.  Write a Pascal procedure to find the node in a linear linked list with the largest data value and move this node to make it the first node in the list.  Data values in the nodes are integer values; each node has only DATA and LINK fields.  Currently, T points to first node in the list.  At the end of the procedure, T should point to the node with the largest data value; that node should point to the first node in the rest of the list and all other nodes should remain in their original order on the list.

2.  Write a Pascal procedure that takes all the nodes on a circular linked list, where T points to the first node, and puts the nodes on the available node list.  Currently, AV points to the first node of the available list.

3.  Write a Pascal procedure that takes a doubly linked circular list with header node and breaks it into two doubly linked circular lists, each with header node and having half the nodes of the original list (in the same order).  The number of data nodes on the list is guaranteed to be an even number; however, this number is NOT currently kept in any variable.  T points to the header node of the original list.  At the end of the procedure, T should point the header node of the first smaller list and S should point to a header node for the second smaller list.  Note:  the only node you are allowed to create in the procedure is the one for the header that S points to.

4.  Let M be a pointer to the header node for row 1, column 1 of a sparse matrix, represented as described in class.  Write a Pascal procedure which takes a row number as a parameter and then displays the nonzero values in that row of the matrix.  The values should be displayed as groups of three numbers:

     row#   column#    value       for all nonzero values 
                                   in the row.