Linked Exercises
Suppose you have a SimpleListADT interface that has the following
public methods:
- void addToEnd(Object element) -- adds the given object to the end of the
list.
- void removeLast() -- removes the last element in the list; if the
list is empty, does nothing.
- void removeNth(int n) -- removes the nth element in the list, 0-based.
If n > length-1, does nothing.
A LinkedSimpleList implementation of the SimpleListADT might start as follows:
public class LinkedSimpleList implements SimpleListADT
{
private front;
//... methods ...
}
Given this framework, write methods addToEnd, removeLast, and removeNth.