sets and maps return if = memo[ return val fib( - fib( - memo[nval return val def main()print(fib( ) if __name__ ="__main__"main(the memoized fib function in sect records any value returned by the function in its memo the memo variable is accessed from the enclosing scope the memo is not created locally because we want it to persist from one call of fib to the next each time fib is called with new value of the answer is recorded in the memo when fib(nis called subsequent time for some nthe memoized result is looked up and returned the resultthe memoized fib function now has (ncomplexity and it can compute fib( almost instantly without memoizationit would take , , , , , , , calls to the fib function to compute fib( assuming each function call completed in microsecondsit would take roughly million years to compute fib( with memoization it takes calls to fib and assuming microseconds per callthat' microseconds or / of second this is an extreme example of the benefit of memoizationbut it can come in handy in many situations for instancein the tic tac toe problem of chap the minimax function is called on many boards that are identical the minimax function does not care if an is placed in the upper-right corner first followed by the lower-left corner or vice-versa yetthe way minimax is written it will be called to compute the value of the same board multiple times memoizing minimax speeds up the playing of tic tac toe correlating two sources of information another use of map or dictionary is in correlating data from different sources assume you are given list of cities and the zip code or codes within those cities you want to provide service where people can look up the zip code for city in the usa soyou'll be given city by the web page that provides you the information you have to use that city to find list of possible zip codes you could search the list of cities to find the corresponding list of zip codes oryou could create dictionary from city name to zip code list then when given city name you check to see if it is in the dictionary and if soyou can look up the corresponding list of zip codes in ( time this copy belongs to 'acha