/* Other forms of recursion */ public class oct26 { // purpose: return sum of ints in A STARTING at index i: int sumarray(int[] A, startindex i) { if (i >= A.length) return 0; // end of array reached else return A[i] + sumarray(A,i+1); } // end sumarray // purpose: return cell at position i cell cellAt(cell L, int i) { if (L == null) return null; else if (i == 0) return L; else return cellAt(L.tail,i-1); } public static void main(String[] args) {} } // end oct26 class cell { int head; cell tail; public cell(int h, cell t) { head = h; tail = t; } }