Category Archives: Algorithm

A Simple LRU Cache Implementation

LRU Cache is a caching strategy where we use Least Recently Used (LRU) eviction policy when the cache is full and we want to add more new data to the cache. LRU cache is used in many caching applications. For … Continue reading

Posted in Algorithm, Caching Algorithm, Data Structure, Linked HashMap | Tagged , , , , | Leave a comment

What’s wrong with binary search!

There’s a bug in the code of “Binary Search” as most of us write it. When asked most of us code binary search as – int binary_search(int *a, int len, int key) { int low = 0; int high = … Continue reading

Posted in Algorithm, Binary Search, Google | Tagged , , , , | 7 Comments