Compare commits

..

No commits in common. "74cad036f816d7da9c6721e924b1809b2b854bf0" and "1623b8b2409f9d7c22c396b13ac7f7eae83ce777" have entirely different histories.

2 changed files with 4 additions and 5 deletions

1
.gitignore vendored
View File

@ -1,3 +1,2 @@
*.o *.o
* *
*.vscode

View File

@ -21,7 +21,7 @@ public:
TwoCache(size_t q1sz, size_t q2sz): cpct_q1(q1sz), cpct_q2(q2sz) {} //ctor TwoCache(size_t q1sz, size_t q2sz): cpct_q1(q1sz), cpct_q2(q2sz) {} //ctor
void put_page(int id) { void put_page(int id) {
if (umap1.find(id) != umap1.end()) { //page is found, nothing to do (fast case) if (umap1.find(id) != umap1.end()) { //page is in fast queue in the end, nothing to do (fast case)
return; return;
} else if (umap2.find(id) != umap2.end()) { } else if (umap2.find(id) != umap2.end()) {
q2.erase(umap2[id]); //if page is in slow put it in fast q2.erase(umap2[id]); //if page is in slow put it in fast
@ -76,7 +76,7 @@ public:
answer += std::to_string(*i) + " "; answer += std::to_string(*i) + " ";
} }
answer.pop_back(); //delete last space answer.pop_back();
return answer; return answer;
} }