if a recursion call is the last execuable statement in the algorithm, called tail recursion, it can easily be removed using iteration,
tail recursion is so named because the return point of each call is at the end of the algorithm.
thus, there are no executable statements to be executed after each call. to change a tail recursion to an iteration, we use the following steps ;
a) use a variable to replace the procedure call
b) use a loop with limit condition as the base case (or its complement)
c) enclose all executable statements inside the loop
d) change the recursive call to an appropriate assignment statement
e) use appropriate statement to reassign calues to parameters
f) return the value of the variable defined in step a
write the iterative version of the recursion factorial algorithm and test it by printing the value of factorial(5) and fac(20)
문제에 답이 있긴한데
일단 비쥬얼 스튜디오 좀 깔고 올께

댓글 (2)
이건 대충 하겠는데
write a recuresive algorithm tht finds all occurrenses of a substring in a string
망할 재귀