LRU Cache Implementation
// LRU Cache implementation #include <iostream> #include <unordered_map> using namespace std; class DLLNode { public: int key; int value; DLLNode *next; DLLNode *prev; DLLNode(int k, int v) { this->key = k; this->prev = NULL; this->value = v; this->next = NULL; } }; //Data structure and globals unordered_map<int, DLLNode*> cache; int Size =0; int capacity; DLLNode * head = new DLLNode(-1, -1); DLLNode * tail = new DLLNode(-1, -1); void addNodeAtHead(DLLNode *node) { node->prev = head; node->next = head->next; head->next->prev = node; head->next = node; return; } void removeNode(DLLNode* node) { DLLNode* prev = node->prev; DLLNode* next = node->next; prev->next = next; next->prev = prev; } int removeFromTail() { DLLNode* temp = tail->prev; removeNode(temp); return temp->key; } void moveToHead(DLLNode *node) { cout << "access this key" << node->key...