LRU Cache
An LRU, or Least Recently Used, cache evicts the item that has not been accessed for the longest time. To achieve O(1) average get and put operations, combine a Hash Map for direct key lookup with a doubly linked list for maintaining recency order. The most recently used item is placed at the front and the least recently used item at the back.
Hash Map provides O(1) average lookup.
Doubly linked list provides O(1) removal and insertion when a node is known.
get: O(1) average.
put: O(1) average.
Eviction removes the tail node.