Skip to content

About

LFU Cache in C++ with comparison to Belady's optimal algorithm

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

12 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LFU Cache

This project provides an implementation of LFU (Least Frequently Used) cache and
Belady’s optimal cache algorithm in C++. It includes:

  1. An implementation of the LFU cache
  2. An implementation of Belady’s optimal cache algorithm
  3. Python scripts for automated testing and comparison

Installation:

Clone this repository, then reach the project directory:

git clone https://github.com/bgclutch/Cache_Task_cpp.git
cd Cache_Task_cpp

Building:

  1. Build the project:
cmake -B build
cmake --build build

Usage:

  1. Navigate to the build folder:
cd build
  1. Choose cache to run:
./lfu/lfu

or

./belady/belady

Running tests:

For End To End tests: 1.1 Navigate to the tests directory:

cd tests/EndToEnd

1.2 Run default tests with the Python script:

python3 testrun.py

1.3 (Optional) Or regenerate test cases:

python3 testgen.py

And run it as in step 2.

For unit tests: 2.1 Navigate to the build folder:

cd build
  1. Run unit tests:
./tests/tests

About

LFU Cache in C++ with comparison to Belady's optimal algorithm

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages