Recursion to Iteration
Need help with explanation on converting recursion to iteration please.
1 2 3 4 5 6 7 8 9 10 11
|
BEGIN SEQ (n)
IF (n EQUALS 1) THEN
RETURN 3
ELSEIF (n EQUALS 2) THEN
RETURN 2
ELSE
RETURN SEQ (n -2) + SEQ (n-1)
ENDIF
END
|
Topic archived. No new replies allowed.