CMPS 13H: Honors Introduction to Programming and Data Structures

Programming Assignment #5: Polynomials II


Remember: your programming assignment must be turned in online.

The Basics

The goals of this program are to a) get more familiar with linked lists, and b) create a more flexible Polynomial class than we had in assignment #3, using linked lists.

In order to get some experience working with linked lists, I want you to convert the linked list code I have provided here to use doubly linked lists. Then you will use these doubly linked lists to implement your new Polynomial class.

To do the assignment, you will have to create a Term class to store both the degree of the term and the constant that it is multiplied by. Each Polynomial will be a linked list of Term objects. The advantage of this over arrays is that you don't have to store zeroes for empty terms, but the disadvantage is that you will have to search the list to find specific terms. For instance, when you want to add two polynomials, you will have to search the list to find terms with matching degree.


The Details

First, you should implement doubly linked lists using my code as a basis. Even though you are modifying existing code rather than writing code from scratch, you should do a careful design before beginning. Remember that doubly linked lists have a previous reference as well as a next reference. That is the only difference, but you have to make sure to manipulate these references correctly.

Second, you should rewrite your Polynomial code. If the details of assignment #3 are not fresh in your mind, you should review that assignment.

Your program must be accompanied by a Makefile and an ASCII Design document (.txt format) that shows:

  1. Inputs
  2. Outputs
  3. Data objects and all non-trivial operations on those data objects
  4. Algorithm(s)

Your program must also contain clear and descriptive variable names and comments, and good formatting that enhances the clarity of the program.


What to turn in

Your java code, your makefile, and your design document.

REMEMBER: Do not submit object files, assembler files, or executables. Every file in the submit directory that could be generated automatically by the compiler or assembler will result in a 5 point deduction from your programming assignment grade.


sbrandt@cse.ucsc.edu