I'm having difficulty implementing a recursive method for the method of inserting an element at the end of a simply linked list.
The following is the Iterative method:
public void addLast(Node<E> novoNodo){
if(isEmpty())
addFirst(novoNodo);
else{
novoNodo.setNext(null);
tail.setNext(novoNodo);
tail = novoNodo;
size++;
}
}
In the exercise I am trying to accomplish, I need to make this method into recursive, but I do not know how I can accomplish this, since the last
method is not a looped method.