Created
April 4, 2021 08:19
-
-
Save smith0022/c052b1b9cc8bf9f861d8f7fdba15b7ee to your computer and use it in GitHub Desktop.
it code using recursive programming to find fibnocci series
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fast_fib(n,memo): | |
if n==1 or n==2: | |
return 1 | |
try: | |
return memo[n] | |
except: | |
final=fast_fib(n-1,memo)+fast_fib(n-2,memo) | |
memo[n]=final | |
return final | |
print(fast_fib(3,{})) | |
print(fast_fib(8,{})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment