This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 241, Section 2
Assignment 2
31 January 2001
Due: Wednesday, February 7 at 11:59 p.m.
Not accepted late.
Total point value of assignment: 100 points
This assignment is to be done INDIVIDUALLY.
Create a directory, A2, which will contain all parts of this assignment.
Include Weiss' singly linked list code for LinkedList, ListNode, and
LinkedListItr, but rename these CULinkedList, CUListNode, and CULinkedListItr.
In addition to renaming the classes, designate the instance variables
"protected" instead of "private."
Design your algorithm for the radix sort, using Weiss's singly linked
list, now stored in CULinkedList. Name the radix sort radixSort and
place it in class Asg2. The main method in class Asg2 will test the
radix sort.
In order to use additional LinkedList methods including
public void append ( ExtLinkedList secondList )
// post: secondList is concatenated to the end of this list
// secondList will be empty at conclusion of call to append
you need to extend the CULinkedList class to include these methods.
Name your extended class ExtLinkedList. The radix sort will use
lists of type ExtLinkedList.
To reiterate, your directory A2 will contain
class CULinkedList
class ExtLinkedList extends CULinkedList
which contains public method append
class CUListNode
class CULinkedListItr
class Asg2
which contains the methods radixSort and main (the test driver)
Data:
The input to your radix sort should be positive integers (type int)
of unknown size. (But, there is a maximum size int.) Assume
numbers will be padded to the left with zeros, if necessary.
For example, if the input is: 25, 2, 13, 3045
the final list will be: 2, 13, 25, 3045.
Output:
Print your name, the assignment number, and a short description
of the assignment to the screen.
The main method should print the list before sorting and
after sorting. This sequence should be repeated several times
as you test various situations, including sorting an empty list.
Follow the style standards to be found from your instructor's
web page for CPSC 241.
Grading rubric:
(1) In the opinion of the instructor the program is an honest attempt
to complete the assignment as described 10 pts.
(2) Name, etc., printed to screen. 5 pts.
Other style standards 15 pts., including
name, etc., not in comments at top of program 5 pts.
not correct indent: 1 pt. per occurrence up to 10 pts.
(3) If requirement (1) above is met and program compiles without error 10 pts.
(4) Program compiles using department test code. 10 pts.
Most likely cause of failure here is failure to follow
program requirements for naming classes and methods.
(5) If requirements (3) and (4) are not met, no further points will be awarded.
(6) radixSort works without error for empty list. 5 pts.
(7) radixSort works with your test program (in main). 5 pts.
(8) append is included in ExtLinkedList and works efficiently. 5 pts.
(9) Quality of your test program (possible only if requirement(7) met) 10 pts.
(10) radixSort works correctly with department test program. 20 pts.
(11) Efficiency (possible only if requirement(10) met) 5 pts.