Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
cjyuan
left a comment
There was a problem hiding this comment.
To better adhere to the Single-Responsibility Principle (SRP) from SOLID design principles, it's preferable to implement the "doubly linked list" and the "LRU Cache" as separate classes, with the linked list used inside LruCache to manage ordering.
You could copy your linked_list.py to this folder.
Alternatively, use a suitable Python built-in class to mantian order.
Could you update your code using one of these approaches?
“I made a separate linked list to track which cache items were used recently. The cache removes the least recently used item when it is full.” @cjyuan |
Learners, PR Template
Self checklist
Task code
CYF-1181
Changelist
Implemented an LruCache class with O(1) average-time get and set operations using a dictionary and doubly linked list.