本文作者原创,首发在本博客;CSDN 上的同名文章已标注为转载并回链到本页:https://blog.csdn.net/qq_30220519/article/details/156096248
背景
怎么样选出最受欢迎的水果中最近购买的品种的价格?
LRU类
1 |
|
LRU键类
1 | class Key { |
LRU扩展类
1 | class LRUCache |
LFU类
1 |
|
使用示例一
1 | // 水果最近有被购买 |
使用示例二
1 | // 统计经常被购买水果价格 |
参考
https://www.geeksforgeeks.org/lru-cache-implementation/
https://leetcode.cn/problems/lru-cache/
https://www.geeksforgeeks.org/least-frequently-used-lfu-cache-implementation/
https://leetcode.cn/problems/lfu-cache/
创作不易,小小的支持一下吧!

