+ 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
Agnibha Chakraborty - avatar
18 Respuestas
+ 9
Ketan Lalcheta Why not 3? Edit: 3 is the right answer.
4th Sep 2018, 8:45 PM
Agnibha Chakraborty
Agnibha Chakraborty - avatar
+ 8
I think no. 1 and 2 are true
4th Sep 2018, 2:17 PM
Ehab Samir
Ehab Samir - avatar
+ 6
3
4th Sep 2018, 7:25 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 5
1
4th Sep 2018, 2:49 PM
code learner
code learner - avatar
+ 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
Ketan Lalcheta - avatar
+ 5
nr 3 : Anything that Recursion can solve can be solved by Iteration. 💖 🤗🙆‍♂️
5th Sep 2018, 10:44 PM
NimWing Yuan
NimWing Yuan - avatar
+ 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
Miguel Angel Acosta - avatar
+ 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
Logomonic Learning - avatar
+ 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
Vasile Eftodii - avatar
+ 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
Sergey Ushakov - avatar
+ 1
#1
5th Sep 2018, 8:00 PM
Raymond Bey
Raymond Bey - avatar
+ 1
3
8th Sep 2018, 12:57 PM
Sim_R
Sim_R - avatar
+ 1
4 one true
27th Apr 2020, 9:15 AM
Sachin Waghmare
Sachin Waghmare - avatar
+ 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
Behnam Sarabi - avatar
+ 1
3
14th Mar 2023, 4:24 PM
Ashuftah Shigri
Ashuftah Shigri - avatar
0
1 and 2 without even thinking
6th Sep 2018, 1:04 AM
Loaie Amgad
Loaie Amgad - avatar
0
i think 3
9th Oct 2018, 4:03 PM
Егор Алексюк
Егор Алексюк - avatar
0
3
16th Oct 2018, 4:30 PM
Madhumitha M