Java TOPIC 25 – IMPLEMENTING A LINKED LIST LESSON WORK NOTE:
This work is based on the partial implementation done during the group
work. Mr. Campeau will direct you
regarding exactly what to do for this work.
QUESTION 1
·
Creates
an empty LinkedList object ·
Inside
a for loop, add 100 random values between 1 and 1000 to the list ·
At
the end, outputs the content of the list to screen. QUESTION 2 Inside
the LinkedList class, implement the method insertAt(int index, int value) that will create a Node with value and place
it at the specified location. QUESTION 3
(TIME PERMITTING) a) Inside the LinkedList
class, implement the method removeFirst() that removes the first node from the linked list. The value that is in that node should be
returned. b) Inside the LinkedList
class, implement the method removeLast() that removes the last node from the linked list. The value that is in that node should be
returned. c) Inside the LinkedList
class, implement the method removeAt(int index) that removes the
index node from the linked list. The
value that is in that node should be returned. d) Test your methods to make sure they
work. |
|