+ 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.
18 Respuestas
+ 9
Ketan Lalcheta Why not 3?
Edit: 3 is the right answer.
+ 8
I think no. 1 and 2 are true
+ 6
3
+ 5
1
+ 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
+ 5
nr 3 : Anything that Recursion can solve can be solved by Iteration. 💖 🤗🙆♂️
+ 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.
+ 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
+ 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).
+ 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.
+ 1
#1
+ 1
3
+ 1
4 one true
+ 1
I think no. 3 is true. The opposite is also true. But I guess Iteration is more comfortable.
+ 1
3
0
1 and 2 without even thinking
0
i think 3
0
3