Which data-structure is best for LRU cache with O(1) ops?
-
A
HashMap
-
B
Deque
-
C
HashMap + DoublyLinkedList
Correct answer
-
D
TreeMap
Correct answer
C. HashMap + DoublyLinkedList
16 views
Explanation
Hash-map + doubly-linked list gives O(1) get/put.
Doubts & discussion
Not sure why the answer is C? Ask here and get an explanation.
Ask a doubt about this MCQ