a guest May 20th, 2018 105 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- // Implement a cache class that stores given item. The cache is limited to a given `size` and will discard the
- // least recently used item if it needs the space.
- // Clearly document design choices, algorithm and possible optimizations.
- // While we require you to implement one memory allocation algorithm,
- // also document future looking design considerations.
- // Implementation Notes:
- // * While the interface below is written in Python, feel free to implement the Cache in the language of your choosing.
- // * Do not use standard library data structures - write your own. (like Python's `collections` module etc.)
- // *** Requirements ***
- // 1. Working code (obviously).
- // 2. Unit tests (using a unit testing library of your choosing)
- // 3. Documentation (as describe in the 2nd paragraph above)
- class Cache(object):
- def __init__(self, size):
- def get(self, key):
- def set(self, key, value):
RAW Paste Data