Skip to content

Conversation

@WillyPhan06
Copy link

Previous Code

class Cache(object):

    def __init__(self, MAX_SIZE):
        self.MAX_SIZE = MAX_SIZE
        self.size = 0
        self.lookup = {}
        self.linked_list = LinkedList()

    def set(self, results, query):
        node = self.map[query]        

In the set function:
self.map[query] was used to retrieve query but it is not defined in the constructor.
So I replaced it with self.lookup.get(query) to correctly do that based on the constructor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants