2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-19 03:25:44 +00:00

Merge pull request #78 from Nondv/remove-recursion-from-root

delete recursion from root
This commit is contained in:
Igor Chubin 2019-10-15 16:05:57 +02:00 committed by GitHub
commit e5fae9de86
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,11 +0,0 @@
# Recursion
# Def: "...is a method where the solution to a problem depends on solutions to smaller instance of the same problem.." - wiki
# TL;DR: a function that calls itself inside its body.
# Recursive programs - Pseduocode
function factorial:
input: integer n such that n >= 0
output: n * (n-1) * (n-2) * ... * 1 = n!
1. if n is 0, return 1
2. else, return ( n * factorial(n-1) )