// Assignment-B7 - Page Replacement in C++ (LRU + Optimal) // BEGINNING OF CODE #include #include #include using namespace std; int refString[] = {0, 2, 1, 6, 4, 0, 1, 0, 3, 1, 2, 1}; int window = 0, hit = 0, miss = 0, currentPages[4], lastUsed[40]; int len = sizeof(refString) / sizeof(refString[0]); int findLRU() { int min_index = 0; for (int i=1; i farthest) { farthest = j; max_index = i; } break; } } if (j == len) { return i; } } return max_index; } void Optimal() { hit = 0; miss = 0; for (int i=0; i>window; LRU(); display(); Optimal(); display(); } // END OF CODE