+ 13

# Recursion

Which of these statements is true?(Any one) 1) Recursion can solve a few problems which Iteration cannot. 2) Iteration can solve a few problems which Recursion cannot. 3) Anything that Recursion can solve can be solved by Iteration. 4) Recursion and Iteration are totally unrelated.

4th Sep 2018, 1:22 PM
Agnibha Chakraborty
+ 9
Ketan Lalcheta Why not 3? Edit: 3 is the right answer.
4th Sep 2018, 8:45 PM
Agnibha Chakraborty
+ 8
I think no. 1 and 2 are true
4th Sep 2018, 2:17 PM
Ehab Samir
+ 6
3
4th Sep 2018, 7:25 PM
blACk sh4d0w
+ 5
1
4th Sep 2018, 2:49 PM
code learner
+ 5
Samrat recursion nd iteration solves problem with different approach... asaik , one can use either of them... Recursion makes code smaller but stack overhead is included where as iteration makes code fatser
4th Sep 2018, 3:19 PM
Ketan Lalcheta
+ 5
nr 3 : Anything that Recursion can solve can be solved by Iteration. 💖 🤗🙆‍♂️
5th Sep 2018, 10:44 PM
NimWing Yuan
+ 4
3. Any recursive algorithm can be rewritten to use loops instead. The opposite is also true. Any iterative algorithm can be written in terms of recursion only.
5th Sep 2018, 1:52 AM
Miguel Angel Acosta
+ 3
recursion uses less code, features a base case e.g. if(x<=1) return 1, and the function calls itself. iteration uses more code and usualy features a loop. #3 is the correct answer. case closed
14th Sep 2018, 12:37 AM
Logomonic Learning
+ 2
The 4th answer is correct. These are two different things. Iteration uses a "for" or "while" statement. Recursion is when a function or procedure calls itself (one or more times).
5th Sep 2018, 8:50 PM
Vasile Eftodii
+ 1
only 1. Iteration can be implemented through the recursion without any other data structures. Recursive function could call itself multiple times during the execution (tower of Hanoi as an example). It requires stack data structure to implement recursion through iteration.
4th Sep 2018, 8:40 PM
Sergey Ushakov
+ 1
#1
5th Sep 2018, 8:00 PM
Raymond Bey
+ 1
3
8th Sep 2018, 12:57 PM
Sim_R
+ 1
4 one true
27th Apr 2020, 9:15 AM
Sachin Waghmare
+ 1
I think no. 3 is true. The opposite is also true. But I guess Iteration is more comfortable.
8th Jul 2020, 11:18 PM
Behnam Sarabi
+ 1
3
14th Mar 2023, 4:24 PM
Ashuftah Shigri
0
1 and 2 without even thinking
6th Sep 2018, 1:04 AM