From 7fc9c10c0bbf371ad6835c80e91c0c69b0383a40 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sun, 21 Jun 2026 16:34:24 +0200 Subject: [PATCH 1/6] tests from contest --- tests/LRU_test.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/tests/LRU_test.cpp b/tests/LRU_test.cpp index 342bd6a..41d0efe 100644 --- a/tests/LRU_test.cpp +++ b/tests/LRU_test.cpp @@ -1,5 +1,6 @@ #include "LRU.hpp" #include +#include namespace { struct page_t { @@ -56,14 +57,31 @@ TEST(LRU, eviction) { lru.lookup_update(1, slow_get_page)); // 1 is not present before lookup } -TEST(LRU, example_from_lecture) { - cache::LRU_t lru{2}; +size_t nhits(const std::vector &input) { + size_t cache_sz = input[0]; + int nelem = input[1]; + cache::LRU_t lru{cache_sz}; size_t hits{}; - for (int page_id : {1, 2, 1, 2, 1, 2}) { + for (int i = 0; i < nelem; ++i) { + int page_id = input[i + 2]; if (lru.lookup_update(page_id, slow_get_page)) hits += 1; } - - EXPECT_EQ(4, hits); + return hits; +} +struct CacheHits { + size_t hit; + std::vector data; +}; +TEST(LRU, example_from_lecture) { + std::vector input_hits = { + {4, {2, 6, 1, 2, 1, 2, 1, 2}}, + {0, {3, 7, 1, 2, 3, 4, 5, 6, 7}}, + {6, {4, 12, 1, 2, 3, 4, 1, 2, 5, 1, 2, 4, 3, 4}} // xxxx12x124x4 + }; + + for (auto &[cache_hits, input_data] : input_hits) { + EXPECT_EQ(nhits(input_data), cache_hits); + } } From a2a06e27f7342e6b12e0e87522acc238b29d1f8c Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 22 Jun 2026 10:22:40 +0200 Subject: [PATCH 2/6] LFU cache with lru order inside --- CMakeLists.txt | 1 + LFU/CMakeLists.txt | 8 ++++ LFU/LFU.hpp | 54 +++++++++++++++++++++ LRU/LRU.hpp | 8 +++- tests/CMakeLists.txt | 2 + tests/LFU_test.cpp | 110 +++++++++++++++++++++++++++++++++++++++++++ tests/LRU_test.cpp | 2 +- 7 files changed, 182 insertions(+), 3 deletions(-) create mode 100644 LFU/CMakeLists.txt create mode 100644 LFU/LFU.hpp create mode 100644 tests/LFU_test.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c3131a..ecc4a9b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,7 @@ set(CMAKE_CXX_EXTENSIONS OFF) add_subdirectory(main) add_subdirectory(LRU) +add_subdirectory(LFU) include(CTest) diff --git a/LFU/CMakeLists.txt b/LFU/CMakeLists.txt new file mode 100644 index 0000000..04c8439 --- /dev/null +++ b/LFU/CMakeLists.txt @@ -0,0 +1,8 @@ +add_library(LFU INTERFACE) + +target_sources(LFU + INTERFACE + FILE_SET HEADERS + FILES + LFU.hpp +) diff --git a/LFU/LFU.hpp b/LFU/LFU.hpp new file mode 100644 index 0000000..99a1aa2 --- /dev/null +++ b/LFU/LFU.hpp @@ -0,0 +1,54 @@ +#pragma once + +#include +#include +#include + +namespace cache { + +template class LFU_t { + size_t sz_; + struct NodeInfo { + KeyT key_; + T page_; + size_t freq_; + }; + std::list cache_; + + using ListIt = typename decltype(cache_)::iterator; + std::unordered_map hash_; + +public: + explicit LFU_t(size_t sz) : sz_{sz} {} + + bool full() const { return cache_.size() == sz_; }; + + template bool lookup_update(KeyT key, F slow_get_page) { + auto hit = hash_.find(key); + if (hit == hash_.end()) { // not found + if (full()) { + hash_.erase(cache_.back().key_); + cache_.pop_back(); + } + auto it = find_mru_node_for_frequency(1); + it = cache_.emplace(it, NodeInfo{key, slow_get_page(key), 1}); + hash_.emplace(key, it); + return false; + } + + auto eltit = hit->second; + eltit->freq_ += 1; + auto it = find_mru_node_for_frequency(eltit -> freq_); + cache_.splice(it, cache_, eltit); + return true; + } + +private: + ListIt find_mru_node_for_frequency(size_t freq) { + return std::lower_bound( + cache_.begin(), cache_.end(), freq, + [](const NodeInfo &node, size_t target) { return node.freq_ > target; }); + } +}; + +} // namespace cache diff --git a/LRU/LRU.hpp b/LRU/LRU.hpp index 16f64cd..2b013b6 100644 --- a/LRU/LRU.hpp +++ b/LRU/LRU.hpp @@ -7,7 +7,11 @@ namespace cache { template class LRU_t { size_t sz_; - std::list> cache_; + struct NodeInfo{ + KeyT key_; + T page_; + }; + std::list cache_; using ListIt = typename decltype(cache_)::iterator; std::unordered_map hash_; @@ -21,7 +25,7 @@ template class LRU_t { auto hit = hash_.find(key); if (hit == hash_.end()) { // not found if (full()) { - hash_.erase(cache_.back().first); + hash_.erase(cache_.back().key_); cache_.pop_back(); } cache_.emplace_front(key, slow_get_page(key)); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index eb26a4e..23fbb18 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -11,6 +11,7 @@ FetchContent_MakeAvailable(googletest) add_executable(caches_test LRU_test.cpp + LFU_test.cpp ) target_compile_options(caches_test @@ -22,6 +23,7 @@ target_compile_options(caches_test target_link_libraries(caches_test PRIVATE LRU + LFU GTest::gtest_main ) diff --git a/tests/LFU_test.cpp b/tests/LFU_test.cpp new file mode 100644 index 0000000..8964daf --- /dev/null +++ b/tests/LFU_test.cpp @@ -0,0 +1,110 @@ +#include "LFU.hpp" +#include +#include + +namespace { +struct page_t { + int id; +}; + +page_t slow_get_page(int page_id) { return page_t{page_id}; } +} // namespace + +TEST(LFU, no_hit) { + cache::LFU_t lfu{3}; + + // cache is empty, no hits + EXPECT_FALSE(lfu.lookup_update(1, slow_get_page)); +} +TEST(LFU, one_hit) { + cache::LFU_t lfu{3}; + + EXPECT_FALSE(lfu.lookup_update(1, slow_get_page)); + EXPECT_TRUE(lfu.lookup_update(1, slow_get_page)); // cache hit +} + +TEST(LFU, is_full) { + cache::LFU_t lfu{2}; + + lfu.lookup_update(1, slow_get_page); // [{1,1}], {page, freq} + lfu.lookup_update(1, slow_get_page); // [{1,2}] + lfu.lookup_update(1, slow_get_page); // [{1,3}] + EXPECT_FALSE(lfu.full()); + + lfu.lookup_update(2, slow_get_page); // [{1,3}, {2,1}] + EXPECT_TRUE(lfu.full()); +} + +TEST(LFU, no_eviction) { + cache::LFU_t lfu{3}; + + EXPECT_FALSE(lfu.lookup_update(1, slow_get_page)); // [{1,1}] {page, freq} + EXPECT_FALSE(lfu.lookup_update(2, slow_get_page)); // [{2,1}, {1,1}] + EXPECT_TRUE(lfu.lookup_update(1, slow_get_page)); // [{1,2}, {2,1}] + EXPECT_FALSE(lfu.lookup_update(3, slow_get_page)); // [{1,2}, {3,1}, {2,1}] + EXPECT_TRUE(lfu.lookup_update(1, slow_get_page)); // [{1,3}, {3,1}, {2,1}] + EXPECT_TRUE(lfu.lookup_update(2, slow_get_page)); // [{1,3}, {2,2}, {3,1}] +} + +TEST(LFU, eviction) { + cache::LFU_t lfu{2}; + + lfu.lookup_update(1, slow_get_page); // [{1,1}] {page, freq} + lfu.lookup_update(1, slow_get_page); // [{1,2}] + lfu.lookup_update(2, slow_get_page); // [{1,2}, {2,1}] + lfu.lookup_update(3, slow_get_page); // [{1,2}, {3,1}] // 3 evicts 2 + + EXPECT_FALSE( + lfu.lookup_update(2, slow_get_page)); // 2 is not present before lookup, node 3 is evicted +} +TEST(LFU, eviction_LRU) { + cache::LFU_t lfu{2}; + + lfu.lookup_update(1, slow_get_page); // [{1,1}] {page, freq} + lfu.lookup_update(2, slow_get_page); // [{2,1}, {1,1}] // freq are the same, but 2 is recently used, though moves forward + lfu.lookup_update(1, slow_get_page); // [{1,2}, {2,1}] // 1 is moved forward for higher freq + lfu.lookup_update(2, slow_get_page); // [{2,2}, {1,2}] // freq are the same, but 2 is recently used, though moves forward + + //adding new page, page 1 should be evicted + lfu.lookup_update(3, slow_get_page); // [{2,2}, {3,1}] + + EXPECT_FALSE( + lfu.lookup_update(1, slow_get_page)); // 1 was not in LFU cache, 3 is evicted + EXPECT_FALSE( + lfu.lookup_update(3, slow_get_page)); // 3 was not in LFU cache, 1 is evicted + EXPECT_TRUE( + lfu.lookup_update(2, slow_get_page)); // 2 is still there + +} + +#if 0 +size_t nhits(const std::vector &input) { + size_t cache_sz = input[0]; + int nelem = input[1]; + + cache::LFU_t lfu{cache_sz}; + size_t hits{}; + for (int i = 0; i < nelem; ++i) { + int page_id = input[i + 2]; + if (lfu.lookup_update(page_id, slow_get_page)) + hits += 1; + } + return hits; +} +struct CacheHits { + size_t hit; + std::vector data; +}; +TEST(LFU, example_from_lecture) { + std::vector input_hits = { + {4, {2, 6, 1, 2, 1, 2, 1, 2}}, + {0, {3, 7, 1, 2, 3, 4, 5, 6, 7}}, + {6, {4, 12, 1, 2, 3, 4, 1, 2, 5, 1, 2, 4, 3, 4}} // xxxx12x124x4 - 6 hits example from slides + }; + + for (auto &[cache_hits, input_data] : input_hits) { + EXPECT_EQ(nhits(input_data), cache_hits); + } +} + +#endif diff --git a/tests/LRU_test.cpp b/tests/LRU_test.cpp index 41d0efe..a0acbc2 100644 --- a/tests/LRU_test.cpp +++ b/tests/LRU_test.cpp @@ -78,7 +78,7 @@ TEST(LRU, example_from_lecture) { std::vector input_hits = { {4, {2, 6, 1, 2, 1, 2, 1, 2}}, {0, {3, 7, 1, 2, 3, 4, 5, 6, 7}}, - {6, {4, 12, 1, 2, 3, 4, 1, 2, 5, 1, 2, 4, 3, 4}} // xxxx12x124x4 + {6, {4, 12, 1, 2, 3, 4, 1, 2, 5, 1, 2, 4, 3, 4}} // xxxx12x124x4 - 6 hits example from slides }; for (auto &[cache_hits, input_data] : input_hits) { From 2f26c6e79d01b638b45278cdf6fdb92fa4c2a89a Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 22 Jun 2026 13:51:19 +0200 Subject: [PATCH 3/6] LFU test + main --- LFU/LFU.hpp | 12 +++++--- LRU/LRU.hpp | 5 ++- main/main.cpp | 7 +++-- tests/LFU_test.cpp | 76 ++++++++++++++++++++++++++++------------------ tests/LRU_test.cpp | 17 +++++++++-- 5 files changed, 79 insertions(+), 38 deletions(-) diff --git a/LFU/LFU.hpp b/LFU/LFU.hpp index 99a1aa2..2334933 100644 --- a/LFU/LFU.hpp +++ b/LFU/LFU.hpp @@ -27,6 +27,9 @@ template class LFU_t { auto hit = hash_.find(key); if (hit == hash_.end()) { // not found if (full()) { + if (sz_ == 0) { + return false; + } hash_.erase(cache_.back().key_); cache_.pop_back(); } @@ -38,16 +41,17 @@ template class LFU_t { auto eltit = hit->second; eltit->freq_ += 1; - auto it = find_mru_node_for_frequency(eltit -> freq_); + auto it = find_mru_node_for_frequency(eltit->freq_); cache_.splice(it, cache_, eltit); return true; } private: ListIt find_mru_node_for_frequency(size_t freq) { - return std::lower_bound( - cache_.begin(), cache_.end(), freq, - [](const NodeInfo &node, size_t target) { return node.freq_ > target; }); + return std::lower_bound(cache_.begin(), cache_.end(), freq, + [](const NodeInfo &node, size_t target) { + return node.freq_ > target; + }); } }; diff --git a/LRU/LRU.hpp b/LRU/LRU.hpp index 2b013b6..387af0b 100644 --- a/LRU/LRU.hpp +++ b/LRU/LRU.hpp @@ -7,7 +7,7 @@ namespace cache { template class LRU_t { size_t sz_; - struct NodeInfo{ + struct NodeInfo { KeyT key_; T page_; }; @@ -25,6 +25,9 @@ template class LRU_t { auto hit = hash_.find(key); if (hit == hash_.end()) { // not found if (full()) { + if (sz_ == 0) { + return false; + } hash_.erase(cache_.back().key_); cache_.pop_back(); } diff --git a/main/main.cpp b/main/main.cpp index c7a109c..049875d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -1,3 +1,4 @@ +#include "LFU.hpp" #include "LRU.hpp" #include #include @@ -6,7 +7,6 @@ int slow_get_page(int key) { return key; } - int main() { std::map cache_hits; size_t sz; @@ -15,6 +15,7 @@ int main() { std::cin >> sz >> nelts; cache::LRU_t lru{sz}; + cache::LFU_t lfu{sz}; for (int i = 0; i < nelts; ++i) { int p; @@ -22,10 +23,12 @@ int main() { assert(std::cin.good()); if (lru.lookup_update(p, slow_get_page)) cache_hits["LRU"] += 1; + if (lfu.lookup_update(p, slow_get_page)) + cache_hits["LFU"] += 1; } std::cout << "Cache type\tN hits\n"; - for(auto [cache_type, nhits]: cache_hits){ + for (auto [cache_type, nhits] : cache_hits) { std::cout << cache_type << "\t" << nhits << std::endl; } return 0; diff --git a/tests/LFU_test.cpp b/tests/LFU_test.cpp index 8964daf..3ea0001 100644 --- a/tests/LFU_test.cpp +++ b/tests/LFU_test.cpp @@ -8,30 +8,34 @@ struct page_t { }; page_t slow_get_page(int page_id) { return page_t{page_id}; } -} // namespace -TEST(LFU, no_hit) { - cache::LFU_t lfu{3}; +TEST(LFU, zero_space_cache) { + cache::LFU_t lfu{0}; + EXPECT_TRUE(lfu.full()); - // cache is empty, no hits EXPECT_FALSE(lfu.lookup_update(1, slow_get_page)); + EXPECT_FALSE(lfu.lookup_update(1, slow_get_page)); + EXPECT_TRUE(lfu.full()); } + TEST(LFU, one_hit) { - cache::LFU_t lfu{3}; + cache::LFU_t lfu{1}; + EXPECT_FALSE(lfu.full()); - EXPECT_FALSE(lfu.lookup_update(1, slow_get_page)); + EXPECT_FALSE(lfu.lookup_update(1, slow_get_page)); // cache is empty, no hits + EXPECT_TRUE(lfu.full()); EXPECT_TRUE(lfu.lookup_update(1, slow_get_page)); // cache hit + EXPECT_TRUE(lfu.lookup_update(1, slow_get_page)); // cache hit + EXPECT_TRUE(lfu.full()); } TEST(LFU, is_full) { cache::LFU_t lfu{2}; lfu.lookup_update(1, slow_get_page); // [{1,1}], {page, freq} - lfu.lookup_update(1, slow_get_page); // [{1,2}] - lfu.lookup_update(1, slow_get_page); // [{1,3}] EXPECT_FALSE(lfu.full()); - lfu.lookup_update(2, slow_get_page); // [{1,3}, {2,1}] + lfu.lookup_update(2, slow_get_page); // [{1,1}, {2,1}] EXPECT_TRUE(lfu.full()); } @@ -54,30 +58,33 @@ TEST(LFU, eviction) { lfu.lookup_update(2, slow_get_page); // [{1,2}, {2,1}] lfu.lookup_update(3, slow_get_page); // [{1,2}, {3,1}] // 3 evicts 2 - EXPECT_FALSE( - lfu.lookup_update(2, slow_get_page)); // 2 is not present before lookup, node 3 is evicted + EXPECT_FALSE(lfu.lookup_update( + 2, slow_get_page)); // 2 is not present before lookup, node 3 is evicted } + TEST(LFU, eviction_LRU) { cache::LFU_t lfu{2}; lfu.lookup_update(1, slow_get_page); // [{1,1}] {page, freq} - lfu.lookup_update(2, slow_get_page); // [{2,1}, {1,1}] // freq are the same, but 2 is recently used, though moves forward - lfu.lookup_update(1, slow_get_page); // [{1,2}, {2,1}] // 1 is moved forward for higher freq - lfu.lookup_update(2, slow_get_page); // [{2,2}, {1,2}] // freq are the same, but 2 is recently used, though moves forward - - //adding new page, page 1 should be evicted + lfu.lookup_update(2, + slow_get_page); // [{2,1}, {1,1}] // freq are the same, but + // 2 is recently used, though moves forward + lfu.lookup_update( + 1, slow_get_page); // [{1,2}, {2,1}] // 1 is moved forward for higher freq + lfu.lookup_update(2, + slow_get_page); // [{2,2}, {1,2}] // freq are the same, but + // 2 is recently used, though moves forward + + // adding new page, page 1 should be evicted lfu.lookup_update(3, slow_get_page); // [{2,2}, {3,1}] - EXPECT_FALSE( - lfu.lookup_update(1, slow_get_page)); // 1 was not in LFU cache, 3 is evicted - EXPECT_FALSE( - lfu.lookup_update(3, slow_get_page)); // 3 was not in LFU cache, 1 is evicted - EXPECT_TRUE( - lfu.lookup_update(2, slow_get_page)); // 2 is still there - + EXPECT_FALSE(lfu.lookup_update( + 1, slow_get_page)); // 1 was not in LFU cache, 3 is evicted + EXPECT_FALSE(lfu.lookup_update( + 3, slow_get_page)); // 3 was not in LFU cache, 1 is evicted + EXPECT_TRUE(lfu.lookup_update(2, slow_get_page)); // 2 is still there } -#if 0 size_t nhits(const std::vector &input) { size_t cache_sz = input[0]; int nelem = input[1]; @@ -91,20 +98,31 @@ size_t nhits(const std::vector &input) { } return hits; } + struct CacheHits { size_t hit; std::vector data; }; + TEST(LFU, example_from_lecture) { + // in the vector the first element is cache size, second is legth of input, + // the rest is input std::vector input_hits = { - {4, {2, 6, 1, 2, 1, 2, 1, 2}}, - {0, {3, 7, 1, 2, 3, 4, 5, 6, 7}}, - {6, {4, 12, 1, 2, 3, 4, 1, 2, 5, 1, 2, 4, 3, 4}} // xxxx12x124x4 - 6 hits example from slides - }; + {0, {0, 3, 1, 2, 3}}, // cache size 0 - 0 hits + {4, {2, 6, 1, 2, 1, 2, 1, 2}}, // xx1212 - 4 hits + {0, {3, 7, 1, 2, 3, 4, 5, 6, 7}}, // no repeats + {6, {4, 12, 1, 2, 3, 4, 1, 2, 5, 1, 2, 4, 3, 4}}, // xxxx12x124x4 - 6 hits + {2, {2, 6, 1, 2, 1, 3, 1, 2}}, // xx1x1x - 2 hits + {4, {3, 9, 1, 2, 3, 1, 2, 4, 1, 2, 3}}, // xxx12x12x - 4 hits + {7, {3, 12, 1, 2, 3, 1, 1, 2, 4, 1, 2, 5, 1, 2}}, // xxx112x12x12 - 7 hits + {5, {4, 12, 1, 2, 3, 4, 1, 2, 1, 5, 1, 2, 3, 4}}, // xxxx121x123x - 5 hits + {7, {3, 11, 1, 2, 3, 1, 1, 2, 1, 4, 1, 2, 1}}, // xxx1121x121 - 7 hits + {3, {1, 5, 1, 1, 2, 2, 2}}, // x1x22 - 3 hits + {9, {3, 12, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3}}}; // xxx123123123 - 9 hits for (auto &[cache_hits, input_data] : input_hits) { EXPECT_EQ(nhits(input_data), cache_hits); } } -#endif +} // namespace diff --git a/tests/LRU_test.cpp b/tests/LRU_test.cpp index a0acbc2..17c7e89 100644 --- a/tests/LRU_test.cpp +++ b/tests/LRU_test.cpp @@ -8,7 +8,15 @@ struct page_t { }; page_t slow_get_page(int page_id) { return page_t{page_id}; } -} // namespace + +TEST(LRU, zero_space_cache) { + cache::LRU_t lru{0}; + EXPECT_TRUE(lru.full()); + + EXPECT_FALSE(lru.lookup_update(1, slow_get_page)); + EXPECT_FALSE(lru.lookup_update(1, slow_get_page)); + EXPECT_TRUE(lru.full()); +} TEST(LRU, no_hit) { cache::LRU_t lru{3}; @@ -70,18 +78,23 @@ size_t nhits(const std::vector &input) { } return hits; } + struct CacheHits { size_t hit; std::vector data; }; + TEST(LRU, example_from_lecture) { std::vector input_hits = { {4, {2, 6, 1, 2, 1, 2, 1, 2}}, {0, {3, 7, 1, 2, 3, 4, 5, 6, 7}}, - {6, {4, 12, 1, 2, 3, 4, 1, 2, 5, 1, 2, 4, 3, 4}} // xxxx12x124x4 - 6 hits example from slides + {6, + {4, 12, 1, 2, 3, 4, 1, 2, 5, 1, 2, 4, 3, + 4}} // xxxx12x124x4 - 6 hits example from slides }; for (auto &[cache_hits, input_data] : input_hits) { EXPECT_EQ(nhits(input_data), cache_hits); } } +} // namespace From 74998f1a4587f06ef0f88171c879f9ee64bf3016 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 22 Jun 2026 21:19:16 +0200 Subject: [PATCH 4/6] LFU main example --- README.md | 10 ++++++++++ main/CMakeLists.txt | 1 + 2 files changed, 11 insertions(+) diff --git a/README.md b/README.md index 3fd263a..65ea5ba 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,16 @@ # cpp_proj +How to run +```bash +./build/main/main <<< "2 6 3 3 1 2 1 2" +``` +output is +```bash +Cahce type \t N hits +type1\tN1 +type2\tN2 +``` diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index c0efbd5..bf48b14 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -13,4 +13,5 @@ target_compile_options(main target_link_libraries(main PRIVATE LRU + LFU ) From 7cf70817d51be826d16ee4a6a9ea433d43841727 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 22 Jun 2026 21:25:36 +0200 Subject: [PATCH 5/6] typo --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 65ea5ba..7c4f8c9 100644 --- a/README.md +++ b/README.md @@ -7,9 +7,9 @@ How to run ``` output is ```bash -Cahce type \t N hits -type1\tN1 -type2\tN2 +Cache type N hits +LRU 3 +LFU 1 ``` From e15de0ac8bfd5809480b572fa2e55f1f9e63853b Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 22 Jun 2026 21:26:59 +0200 Subject: [PATCH 6/6] example in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7c4f8c9..48cdd45 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ How to run ```bash -./build/main/main <<< "2 6 3 3 1 2 1 2" +./build/main/main <<< "2 6 3 3 1 2 1 2" # cache_size Nelem elem1 elem2 ... ``` output is ```bash