A linked list would probably work well for LRU - just add items to the head of the list, move items back to the head of the list when they are used again, and drop items from the tail of the list when you need space. This would also eliminate the need for a timestamp.
Yes, now I understood that linked list type solution!
So simple way to resolve this kind on problem without timestamp, Thanks to you!
BTW I'm looking good
Java algorithm books, can anyone suggest me good ones?
I'm not looking for books like Core Java/Horstman (which is a good book)
rather books telling different kind of algorithms/data structures. I have
read Cormen's book when I was studying but code it that book is pseudocode
and it does not offer as much examples considering e.g. graphs, searching etc. that I would like to read.
Best Regards!