Home > Back-end >  What is the difference between recursive function and loop statement?
What is the difference between recursive function and loop statement?

Time:11-08

Feel the essence of recursion is cycle itself, so the recursive recursive loop said, or recursion is a subset of the set of loop, but lack of knowledge of this respect, strives for the bosses, correctly explain the

CodePudding user response:

Python if using the eval statement, can use a loop to realize recursion

CodePudding user response:

Send the wrong figure this monkey figure with not accustomed to

CodePudding user response:

Don't know what you study is that language, but in c + + based circulation are two,
1, for; Know starting conditions, termination conditions,
2, while; Know what kind of conditions jumped out,

In addition recursive, generally is the function, only know the situation or at the next higher level or lower level conditions, but know the finish or head conditions,
Then use recursive functions,
Looks similar to cycle, but there is a big difference,

CodePudding user response:

reference ZHGWBZHD reply: 3/f
don't know what you study is that language, but in c + + based circulation are two,
1, for; Know starting conditions, termination conditions,
2, while; Know what kind of conditions jumped out,

In addition recursive, generally is the function, only know the situation or at the next higher level or lower level conditions, but know the finish or head conditions,
Then use recursive functions,
Looks similar to cycle, but there is a big difference,

Thank you thank you! ?? I see,

CodePudding user response:

From the bottom to say: standard C language, and both have difference, recursion to pressure the stack, loop is not needed,
But now, c + + language circulation also needs to be pressed out of the stack, as defined in the loop variables with the same name outside of the loop is different two variables,

So now the recursive and cycle is the same
  • Related