Skip to content

This is a Python example of recursion algorithms, with explanations.

License

Notifications You must be signed in to change notification settings

DenalidTX/python-recursion-sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Python Recursion Sample

"Recursion" refers to the technique in which a function calls itself. This allows a problem (generally a mathematical function or set operation) to break down the computation or input data into a smaller version of the same problem. Eventually the algorithm reaches the "base case", which is the case that requires the least amount of computation. Specifically, the base case does not require recursion.

When writing a recursive function, it is helpful to have the base case appear first, for two reasons: First, if you are formulating a solution then knowing the base case can help you reason about the problem. Second, having the base case first helps to avoid errors that result in infinite recursion.

Please note that I wrote these samples in a hurry, so if there's a bug don't judge me. :-)

About

This is a Python example of recursion algorithms, with explanations.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages