Data Structure: HashMap + Doubly Linked List
Time Complexity: O(1) for get and put | Space Complexity: O(capacity)
- lruCache.js - Complete LRU Cache implementation
- lruFunction.js - LRU Cache function implementation
- Use Case: Cache with least recently used eviction policy
- Operations:
get(key): O(1) - Get value by keyput(key, value): O(1) - Insert or update key-value pair
- Data Structures:
- HashMap: For O(1) key lookup
- Doubly Linked List: For O(1) insertion/deletion
- LeetCode 146: LRU Cache
- Design a cache system
- Implement cache with eviction policy