MCPcopy Create free account
hub / github.com/ByteByteGoHq/coding-interview-patterns / LRUCache

Method LRUCache

cpp/Linked Lists/lru_cache.cpp:22–27  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20 DoublyLinkedListNode* head;
21 DoublyLinkedListNode* tail;
22 LRUCache(int capacity) : capacity(capacity) {
23 head = new DoublyLinkedListNode(-1, -1);
24 tail = new DoublyLinkedListNode(-1, -1);
25 head->next = tail;
26 tail->prev = head;
27 }
28 // Destructor: Cleans up dynamically allocated resources
29 // to prevent memory leaks. Implemented if time permits
30 // during an interview.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected