Skip to content

Commit a7aab8b

Browse files
committed
LFU cache with comments has been added
1 parent ce475ca commit a7aab8b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Linked List/LFU_Cache.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515

1616
// solution -->
1717

18+
//minFreq is the smallest frequency so far
19+
//The main idea is to put all keys with the same frequency to a linked list so the most recent one can be evicted;
20+
//mIter stored the key's position in the linked list;
21+
1822

1923
#include <bits/stdc++.h>
2024
using namespace std;
@@ -76,4 +80,6 @@ class LFUCache {
7680
minFreq=1; // since new element added min freq will be 1;
7781
size++; // increase size
7882
}
79-
};
83+
};
84+
85+

0 commit comments

Comments
 (0)