Repository navigation
London | 26-Jul-SDC | Shaghayegh far| Sprint 2 | Implement LRU Cache - #250
shaghayeghfar wants to merge 2 commits into
Conversation
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 maintain order.
Could you update your code using one of these approaches?
|
Dear @cjyuan |
cjyuan
left a comment
There was a problem hiding this comment.
Code looks correct.
Note: A typical linked list node stores one value (instead of a key and a value). Even if it stores only one value, we could still store the key/value pair as a tuple in the linked list node.
Learners, PR Template
Self checklist
Task code
CYF-1181
Changelist
Implemented an LRU cache using a dictionary and doubly linked list to support O(1) get and set operations.