CACHE页面置换算法LRU的C语言实现.pdfVIP

  • 17
  • 0
  • 约7.67千字
  • 约 6页
  • 2022-05-22 发布于江苏
  • 举报
通过一道题目学习下cache 的LRU 算法。c 语言实现。 LRU 算法是最久未使用替换算法,就是假设 用到的数据,将来用到几率也非常大。每 次淘汰cache 中最久没有使用的元素。 题目: Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. set(key, value) - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item. 所以,目标就是要设计一个cache 系统

文档评论(0)

1亿VIP精品文档

相关文档