Answer the question
In order to leave comments, you need to log in
Whether correctly I paint process of a recursion?
Actually here:
I ask you to direct me on the path of truth, if I am mistaken somewhere, but not by a decision, but by a tip.
And yet, how to learn to solve problems using recursion without writing the whole process on a piece of paper? Probably, at the initial level, in any way? I solved the problem somehow intuitively, which is not very pleasing. Well, not quite right.
Answer the question
In order to leave comments, you need to log in
call the function and pass it 2 - start, 6 - end, 2 - step
condition check 2 < 6, yes, return 2 + call the function, pass it 4 - start (2 + step), 6 - end, 2 - step
check condition 4 < 6, yes, return 4 + call the function, pass it 6 - start (4 + step), 6 - end, 2 - step
check condition 6 < 6, no, return 6
total: 2 + 4 + 6 = 12
They say "to know recursion, you need to know recursion"
With experience, understanding will come, write a couple of times and you will understand, the main condition for the exit is not to forget.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question