Pergunta de entrevista da empresa LinkedIn

Design LRU Cache

Respostas da entrevista

Sigiloso

2 de abr. de 2013

Use a priority queue. It can be reordered in terms of time accessed.

1

Sigiloso

7 de jun. de 2011

I tried to come out with a complicated solution, but they wanted the simplest one. A Hashmap and doubly linked list should satisfy them. Keep putting the recently accessed node on top of the queue and while inserting a new element, if its full, remove the last node in the queue.

Sigiloso

23 de fev. de 2012

why not use a minHeap?