I think this can be implemented with queue data structure. Whenever an
element is used, remove it from the queue use it and then again insert
it in the queue at the back. So the front element in the queue is the
least recently used one.

-Abhirup


On Fri, Jul 2, 2010 at 10:23 PM, jaladhi dave <jaladhi.k.d...@gmail.com> wrote:
> keep n bits (depending on the usage level you want) to track for each
> element (cell/page) etc in the cache.
>
>
> Now whenever an element is loaded into cache set all the bits and on further
> use increment by 1 if not max value. Decrement value by 1 for all the block
> periodically.
>
> Now whenever you need to remove an element, select one with least value.
>
>
> On Fri, Jul 2, 2010 at 6:59 PM, sharad kumar <sharad20073...@gmail.com>
> wrote:
>>
>> how would u implement LRU cache
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algoge...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algoge...@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to