Homework 6 Csc309.
Due Monday May 8, 2006 by 11:59pm.
Problem 1
25 points.
To receive full credit you must demonstrate your methods. Work incrementally, that is after you write a method test it.
Add the following methods to IntLinkedList worked out in class.
- Write a method that will add an integer to the front of the list NOT replace the front element. Don't forget about the case where the list is empty
void push_front(int number);
int & back();
int & front();
void insert(int index, int number);
void pop_front();
void append(IntLinkedList & rhs);
Example
Let list1 and list2 be two IntLinkedList objects. After the call to append
list1.append(list2);
list2 will be attached to the back of list1.
void sort();Extra Credit
(2 percent)
- Write a method to remove duplicates from the list. The pre condition to the method is that that list is sorted.
void unique();
Submit this method along with your homework using hw6-1 link. The hw6-E link is for grading purposes.