

smallerSol = delete( head.next ); // Have someone else delete the last // node in a SHORTER list and return // back the new list head.next = smallerSol; // Use the smaller solution to // solve the original problem solution = head; // The solution is the list starting // at head return solution; // Return the solution 
(I will put the pseudo code inside the recursive method later)

/* ============================ Base cases ============================ */ if ( list is empty ) // Base case 1 { solution = empty list; return solution; } else ( list contains 1 node ) // Base case 2 { solution = empty list; return solution; } else { smallerSol = delete the last node from the list starting at head.next head.next = smallerSol; // Solve problem with smaller solution solution = list starting at head; return solution; } 
public static Node delete( Node head ) { Node solution, smallerSol; /* ============================ Base cases ============================ */ if ( head == null ) // Base case 1 { solution = null; return solution; } else if ( head.next == null ) // Base case 2 { solution = null; return solution; } else { /* ================================================= I know the list is not empty... And "head.next" points to a SHORTER list ! ================================================= */ smallerSol = delete( head.next ); // Have someone else delete the last // node in a SHORTER list and return // back the new list head.next = smallerSol; // Solve problem with smaller solution solution = head; // Solution = list starting at head return solution; // Return the head of the new list } } 
public static void main( String[] args ) { Node head = null; Node e; double[] a = {4, 1, 3, 7}; for ( int i = 0; i < a.length; i++) { e = new Node(a[i]); head = RecursiveList.insert(head, e); } RecursiveList.printList( head ); for ( int i = 0; i < a.length; i++) { head = RecursiveList.delete(head); // delete() returns the new list RecursiveList.printList( head ); } } 
Output:
[4.0 , 1.0 , 3.0 , 7.0] [4.0 , 1.0 , 3.0]  tail node deleted ! [4.0 , 1.0] [4.0] [] 
How to run the program:
