From fbd77551b3196b15f7ea3373ad0efebc13fd47c1 Mon Sep 17 00:00:00 2001 From: Oleksii Trekhleb Date: Mon, 23 Jan 2023 18:44:46 +0100 Subject: [PATCH] Update time complexity table for LRU. --- src/data-structures/lru-cache/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/data-structures/lru-cache/README.md b/src/data-structures/lru-cache/README.md index 2076115f..2e964239 100644 --- a/src/data-structures/lru-cache/README.md +++ b/src/data-structures/lru-cache/README.md @@ -16,7 +16,7 @@ The functions `get()` and `set()` must each run in `O(1)` average time complexit ## Implementation -See the `LRUCache` implementation example in [LRUCache.js](./LRUCache.js). The solution uses a `HashMap` for fast `O(1)` cache items access, and a `DoublyLinkedList` for fast `O(1)` cache items promotions and eviction (to keep the maximum allowed cache capacity). +See the `LRUCache` implementation example in [LRUCache.js](./LRUCache.js). The solution uses a `HashMap` for fast `O(1)` (in average) cache items access, and a `DoublyLinkedList` for fast `O(1)` (in average) cache items promotions and eviction (to keep the maximum allowed cache capacity). ![Linked List](./images/lru-cache.jpg)