Algorithms and Data Structures · Senior · Question 39 of 75
When does LFU beat LRU as a cache eviction policy?
- ✓Correct answer: When a few items stay popular while scans touch many items once
- 2When access patterns change quickly and recent data matters most
- 3When the cache holds only a handful of entries
Explanation
One big scan can push all hot items out of an LRU cache. LFU keeps frequently used items, but adapts slowly when popularity shifts. Modern caches (W-TinyLFU in Caffeine) combine recency and frequency.