A recursive algorithm solves a problem by solving a little bit of the problem, leaving a simpler version of the problem left over. Then it solves that remaining problem the same way.
For example, the factorial of N is either;
1, if N is 1, or
N times the factorial of (N-1)
For more detail, read a textbook or Wikipedia or something.
[add]
Well it looks like NotN made the Wikipedia option really easy for you.
Message was edited by:
paulcw
//example of recursive method that calculate sum of Integer element
//at vector object
public static int sum_list(Vector<Integer> vint, int i){
if (i == vint.size()){
return 0;
} else {
return vint.elementAt(i++) + sum_list(vint, i);
}
}
//
regards
p_epi