I love to trace a recursive function, I can do that in my sleep haha, but the thought of writing a recursive function is a challenge that I don't want to face, even though i know it will reappear on the second midterm.
The base case if you didn't know by now, is the simplest case that doesn't require recursion, it usually will be part of an if statement, that returns a generic statement such as; Return False, or Return 1; and after that the 'else' statement is the recursing one. Through my experiences when writing a recursive method on trees, the recursive part is usually [ method name (x) for x in [child or node...etc]]. As struggling as a recursive method may be and the fact that I haven't really used it unless told too, I fell recursion is a tool I should wield in my computer science tool belt.
No comments:
Post a Comment