I tried solving a basic problem with and without memoization technique,but the time complexity is almost same,so whats the exact difference,where the code with memoization is increasing the lines of code.
#memoization technique
#with
def memo(n):
d = {}
if n == 1:
return 1
elif n == 0:
return 1
else:
d[n] = memo(n-1) + memo(n - 2)
if n in d :
return d[n]
print(memo(5))
#without
def memo(n):
d = {}
if n == 1:
return 1
elif n == 0:
return 1
else:
return memo(n-1) + memo(n - 2)
print(memo(5))