Description:Recursion-1 problems for python
Basic recursion problems. Recursion strategy: first test for one or two base cases that are so simple, the answer can be returned immediately. Otherwise, make a recursive a call for a smaller case (that is, a case which is a step towards the base case). Assume that the recursive call works correctly, and fix up what it returns to make the answer. The first problem below (python_recursion_eg) has a basic example with a detailed hint.
You can see a more thorough introduction to recursion at topcoder. The basics are covered up to the "Why Use Recursion" heading, or you can read through the entire thing for a deep introduction to the subject. ( https://www.topcoder.com/community/data-science/data-science-tutorials/an-introduction-to-recursion-part-1/ )
python_recursion_eg H factorial H bunnyEars
bunnyEars2 triangle count8
fibonacci countX countHi
Copyright Nick Parlante 2017 - privacy