LRU的C++的简单实现

2015-07-20 17:51:35 · 作者: · 浏览: 3

class LRUCache提供两个接口:get(int key)和set(int key,value)

#include
  
   

using namespace std;



class LRUCache{
public:
    LRUCache(int cap):current(0),capacity(cap){
        A=new node[cap];
    }
    int get(int key) {
        for(int i=0;i
   
    
测试: