[Amazon]Implement LRU cache

Implement the LRU cache algorithm. Given following interface.
CacheStrategy<K, T> {
    // get the data by key from the cache.
    T get(K key);
 
    // put <key, data> pair to the cache
    void put(K key, T data);
}
where k is key and T is data part.
Note: All operation should be o(1).

Comments

  1. Did not understand? R u talking about the Least Recent Used method we studied for Page Fault Counting in Operating System Concepts course?

    ReplyDelete
  2. @Tanmay yes it same as Least Recent Used method we studied for Page Fault Counting in Operating System Concepts

    ReplyDelete
  3. Then I already have my program on this, I will post it hopefully tonight as my pc is at doctor's corner right now...

    ReplyDelete

Post a Comment

Popular posts from this blog