Compare commits

...

2 Commits

Author SHA1 Message Date
ag
74cad036f8 deleted .vscode 2024-09-17 12:21:53 +03:00
ag
03036ff185 last commit 2024-09-17 10:24:26 +03:00
2 changed files with 5 additions and 4 deletions

3
.gitignore vendored
View File

@ -1,2 +1,3 @@
*.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 in fast queue in the end, nothing to do (fast case) if (umap1.find(id) != umap1.end()) { //page is found, 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
@ -52,7 +52,7 @@ public:
return; return;
} }
} }
void print_info() { void print_info() {
std::cout << "\nq1 (the most usable): "; std::cout << "\nq1 (the most usable): ";
@ -76,7 +76,7 @@ public:
answer += std::to_string(*i) + " "; answer += std::to_string(*i) + " ";
} }
answer.pop_back(); answer.pop_back(); //delete last space
return answer; return answer;
} }