I find recursion so confusing. I feel like a legit retard, makes my sympathize with dyslexics.
>>59195013
Nigger wtf
>>59195013
You just need to take a step back and look at the bigger picture.
>>59195013
>DAD! I cannot build this lego house! It is so confusing!
>Ok son, let us break it down to make it easier. Maybe we can build each room by itself first?
>But dad, even the rooms are a bit tough!
>Ok son, let us build the walls and floor of each room first.
>Oh... that is smart. Thanks dad!
>You are most welcome, son.
>I love you dad!
>I love you too, son.
>>59195095
I can't relate to that at all. it's not helping me understand
things go in, and go in again
can't explain that
>>59195479
There are two parts to recursion: The theory, and the application.
Theory: Recursion is when a function calls itself.
Application: When a problem is too big for a function to handle, break it into chunks and feed the chunks to the function. If any chunk is too big, break it down into even smaller chunks, until you get chunks that the function can handle.
Ask yourself "does the way a program executes change when you make a recursive call"
The answer is no, when that recursive call ends, the program continues.
P(P(P(a)))
Work from the inside out.
>>59195013
Three rules to recursion:
1. The functions has to call itself
2. There must be a clear reachable moment (condition) when the recursion will end.
3. After each iteration, we should be getting closer to approaching the moment from point two.
>>59195013
Just practice with simple problems for an hour or two. It's really all about getting into the groove of using the steps >>59197900
describes.