got a question about Linked-List in java code.
- by glacier89
Linked-List: Mirror
Consider the following private class for a node of a singly-linked list of integers:
private class Node{
public int value;
public Node next;
}
A wrapper-class, called, ListImpl, contains a pointer, called start to the first node of a
linked list of Node.
Write an instance-method for ListImpl with the signature:
public void mirror();
That makes a reversed copy of the linked-list pointed to by start and appends that copy
to the end of the list. So, for example the list:
start 1 2 3
after a call to mirror, becomes:
start 1 2 3 3 2 1
Note: in your answer you do not need to dene the rest of the class for ListImpl just
the mirror method.