Skip to content

Commit 28b5584

Browse files
authored
remove whitespace
1 parent 6360b25 commit 28b5584

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

fibonacci with memoization.py

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# coding: utf-8
33

4-
# this is a test on how recursion with memory reduces time complexity
4+
#this is a test on how recursion with memory reduces time complexity
55

66
#i need a global dictionary to do the memorization
77
#or i can change function fib(n) into fib(n,mem)
@@ -25,8 +25,8 @@ def fib(n):
2525
mem[n]=(fib(n-1)+fib(n-2))
2626
return mem[n]
2727

28-
#this is the fibonacci recursion function without memory
29-
#it is basically algorithm 101 for any coding language
28+
#this is the fibonacci recursion function without memory
29+
#it is basically algorithm 101 for any coding language
3030
def f(n):
3131
if n==1:
3232
return 1
@@ -35,8 +35,8 @@ def f(n):
3535
else:
3636
return f(n-1)+f(n-2)
3737

38-
# i calculate how long these two functions take
39-
#print out the comparison
38+
#i calculate how long these two functions take
39+
#print out the comparison
4040
def compare(n):
4141
t1=dt.datetime.now()
4242
f(n)
@@ -49,14 +49,4 @@ def compare(n):
4949
print('recursion with memory: ',t2-t1)
5050

5151

52-
53-
54-
5552
compare(20)
56-
57-
58-
59-
60-
61-
62-

0 commit comments

Comments
 (0)