Unformatted text preview:

Department of Computer Science Intro to Parallel ComputingProgramming Assignment 1Due Wednesday, February 9 at 3 pmModify the linked list implementation of the “Student Database” program as follows.1. In the online version, the head node is an ordinary node: when the list is nonempty,it stores the record of a student. This results in relatively complex logic for thedeleteStudent method. This method can be greatly simplified if the head node isa “dummy” node, i.e., a node that does not store information on an actual student.Rather, if the list is nonempty, head.next stores the first actual student record. ForHomework Assignment 2, you should modify the online version so that all of the publicmethods, except deleteStudent, use the dummy node. For the first part of program-ming assignment 1, you should complete this modification so that the entire class usesa dummy head node.2. The array implementation of the student database inserts new student records at theend of the list. The online linked list implementation inserts new student records atthe head of the list. Modify the program so that in addition to a dummy head node,there’s a dummy tail node reference, whose next member refers to the last node in thelist. Then modify the insertStudent method to use this node to insert new studentrecords at the end of the list. There are a variety of ways to implement an empty list.One possibility is to make the next member of both head and tail null.3. Execution of new is quite an expensive and time-consuming operation. One way toreduce the cost of this part of the student database is to store a free list. Each timea node is deleted, it is added to the free list. Each time a node is added to the list,the free list is first checked to see if there’s an available node. I f there is, the firstnode in the free list is used. If there isn’t, the program executes new. The free listcan be implemented as a stack: there’s a dummy head node; insertions occur at thehead or top of the list; and deletions from the free list can also occur at the top. Notethat for this part, you should not bother trying to reuse Student objects: only reuseStudentNode objects.In general, it will be much easier to implement, test, and debug these parts in order.Complete part 1 before starting part 2, and complete part 2 before starting part 3. It willalso be much easier to design these on paper before writing any code. Test your design forall the special cases you can think of, e.g., insert into empty list, attempt to delete fromempty list, etc.The StudentDB class should link with the online StudentDBMain and Student classes.So it should accept the same input that the existing online program accepts.1Extra HelpOur TA, Anna Tikhonova, will have an office hour on Tuesday evening from 5:30 to 6:30 inHarney 536.SubmissionRemember to copy your source code to /home/submit/cs245/youruserid before 3 pmWednesday. For example, I would typecp StudentDB.java /home/submit/cs245/peterYour submitted program should be named StudentDB.java. You should also get a printoutof your program to me by 6pm Wednesday.Programs that are late but less than 24 hours late will have their scores reduced by 50%.Programs that are more than 24 hours late will receive no credit.Grading1. Correctness will be 50% of your grade. Does your program correctly implement allof the required changes. Does it correctly insert and delete and search and print thedatabase?2. Documentation will b e 20% of your grade. Does your header documentation includethe author’s name, the purpose of the program, and a description of how to use the pro-gram? Are the identifiers meaningful? Are any obscure constructs clearly explained?Are the purpose and usage of the classes and methods clearly explained?3. Source format will be 20% of your grade. Is the indentation consistent? Have blanklines been used so that the program is easy to read? Is the use of capitalizationconsistent? Are there any lines of source that are longer than 80 characters (i.e., wraparound the screen)?4. Quality of solution will be 10% of your grade. Are any of your methods more than 30lines (not including blank lines, curly braces, or comments)? Are there multipurposemethods? Is your solution too clever — i.e., has the solution been condensed to thepoint where it’s incomprehensible?CheatingRemember that you can discuss the program with your classmates, but you cannot look atanyone else’s source code. (This includes source code that you might find on the


View Full Document

USF CS 245 - Programming Assignment 1

Download Programming Assignment 1
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Programming Assignment 1 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Programming Assignment 1 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?