当前位置:网站首页>LeetCode 146. LRU cache
LeetCode 146. LRU cache
2022-06-12 22:56:00 【Go to bed early and be healthy HH】
Topic link :https://leetcode-cn.com/problems/lru-cache/
cache (Cache) It is a technology to improve data reading performance , In hardware design 、 It is widely used in software development , For example, the common CPU cache 、 Database cache 、 Browser caching and so on .
The size of the cache is limited . When the cache is full , What data should be cleaned out , What data should be kept , This requires a cache obsolescence strategy .
FIFO(First In First Out), First in, first out strategy
thought : If a data is the first to enter , So it can be thought that in the future it is very unlikely to be visited . When the space is full , The data that enters first will be eliminated first .
LFU(Least Frequently Used), Least recently used strategy
thought : If data is rarely accessed in a recent period of time , So it can be thought that it is unlikely to be visited in the future . therefore , When the space is full , The least frequently accessed data is the first to be eliminated .
LRU(Least Recently Used), The last time you haven't used a strategy recently
thought : If a data has not been accessed in a recent period of time , So it can be thought that it is unlikely to be visited in the future . therefore , When the space is full , The data that has not been accessed for the longest time is eliminated first .
Intuitive ideas : Store the most recently used elements near the top of the cache , When a new entry is accessed ,LRU Put it at the top of the cache . When the cache is full , Entries accessed earlier will be removed from the bottom of the cache .
Hashtable + Array
Hashtable + Single chain list
Hashtable + Double linked list
边栏推荐
- 【LeetCode】5. 最长回文子串
- JVM foundation > GC generation: minorgc majorgc fullgc mixed GC
- Module 8 operation
- C语言:如何给全局变量起一个别名?
- Photoshop:PS如何实现放大图片不模糊
- China barcode decoder market trend report, technical innovation and market forecast
- Analysis report on production and marketing demand and investment forecast of China's Melamine Industry from 2022 to 2028
- Lua date time
- 【LeetCode】209. Minimum length subarray
- iShot
猜你喜欢
管线中的坐标变换
[recommended collection] easy to understand graphic network knowledge - Part 1
80 lines of code to realize simple rxjs
Inventory of CV neural network models from 2021 to 2022
C语言:如何给全局变量起一个别名?
JVM Basics - > how GC determines that an object can be recycled
Anti aliasing / anti aliasing Technology
Hostvars in ansible
Shardingsphere-proxy-5.0.0 deployment table implementation (I)
The carrying capacity of L2 level ADAS increased by more than 60% year-on-year in January, and domestic suppliers "emerged"
随机推荐
Common rendering pipeline grooming
Database daily question --- day 10: combine two tables
Colab教程(超级详细版)及Colab Pro/Colab Pro+使用评测
ShardingSphere-proxy-5.0.0部署之分表实现(一)
Dix points de défense clés dans les exercices d'attaque et de défense détaillés
ImageView grayed, reflected, rounded, watermarked
iShot
[leetcode] sword finger offer II 020 Number of palindrome substrings
Ten key defensive points in the detailed attack and defense drill
【LeetCode】103. 二叉树的锯齿形层序遍历
PHP删除二维数组中相同项的数据
Market trend report, technical innovation and market forecast of Chinese stump crusher
China barcode decoder market trend report, technical innovation and market forecast
常见渲染管线整理
VIM use the lower right 4 keys
【LeetCode】102. Sequence traversal of binary tree
JVM foundation > G1 garbage collector
The interface testing tool apipos3.0 is applicable to process testing and reference parameter variables
The programmer dedicated to promoting VIM has left. Father of vim: I will dedicate version 9.0 to him
Global and Chinese Melamine Industry Development Research and prospect trend report 2022-2028