Hi This a very generic question. I Want to know can whether every Iterative method(using loops) can be done using recursion?
Asked
Active
Viewed 162 times
0
-
1YES !! :) Already answered here - http://stackoverflow.com/questions/2093618/can-all-iterative-algorithms-be-expressed-recursively – Pranay Agrawal Feb 01 '14 at 19:32
3 Answers
0
I Want to know can whether every Iterative method(using loops) can be done using recursion?
Yes, see Church–Turing thesis, it proves this.
Useful links:

Maroun
- 94,125
- 30
- 188
- 241
0
Here is a generalized iterative function :-
for(int i=0;i<n;i++) {
doSomething(i);
}
Here is equivalent recursive function :-
recfunc(int i,int n) {
if(i<n) {
doSomething(i);
recfunc(i+1,n);
}
}

Vikram Bhat
- 6,106
- 3
- 20
- 19