One of my favorite ways of thinking about recursion (and proofs by induction) is the recursion goblins.
When you're writing a recursive function, you don't worry about how you got your input. The recursion goblins took care of that.
You also don't need to worry about what will happen to the thing that you return. The recursion goblins will take care of that, too.
All you need to worry about is what's happening in between the curly brackets, which is that you should make your problem a little smaller. The recursion goblins will take care of the rest.
This was weirdly freeing for me in CS 101/102/103 etc.; I was getting way too wrapped up in trying to visualize the recursion from start to finish, and that's a crapshoot at the best of times, even if it's sometimes important. Much more often, though, you can get a lot done a lot faster if you trust the goblins!
(Thanks to Professors Shindler and Cote for this one)
When you're writing a recursive function, you don't worry about how you got your input. The recursion goblins took care of that.
You also don't need to worry about what will happen to the thing that you return. The recursion goblins will take care of that, too.
All you need to worry about is what's happening in between the curly brackets, which is that you should make your problem a little smaller. The recursion goblins will take care of the rest.
This was weirdly freeing for me in CS 101/102/103 etc.; I was getting way too wrapped up in trying to visualize the recursion from start to finish, and that's a crapshoot at the best of times, even if it's sometimes important. Much more often, though, you can get a lot done a lot faster if you trust the goblins!
(Thanks to Professors Shindler and Cote for this one)