Skip to content

Commit fd94736

Browse files
Add C++ implementation
Signed-off-by: begeekmyfriend <begeekmyfriend@gmail.com>
1 parent e58c64e commit fd94736

File tree

4 files changed

+479
-19
lines changed

4 files changed

+479
-19
lines changed

146_lru_cache/lru_cache.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class LRUCache {
1919
return -1;
2020
}
2121

22-
int value = ht_[key]->second;
22+
int value = (*ht_[key]).second;
2323
if (li_.front().first != key) {
2424
li_.erase(ht_[key]);
2525
li_.push_front(make_pair(key, value));

460_lfu_cache/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
all:
2-
g++ -O1 -std=c++11 -o test lfu_cache.cc
2+
gcc -O1 -o test lfu_cache.c
3+
#g++ -O1 -std=c++11 -o test lfu_cache.cc

0 commit comments

Comments
 (0)