Skip to content

Conversation

corvo-007
Copy link
Contributor

Description of Change

LFU Cache implementation
In a fixed size cache, when new item is added and the cache is full
The least frequently used element is evicted from the cache

If there are multiple items with the same frequency of usage,
then the least recently used item is evicted.

Checklist

  • Added description of change
  • Added file name matches File name guidelines
  • Added tests and example, test must pass
  • Added documentation so that the program is self-explanatory and educational - Doxygen guidelines
  • Relevant documentation/comments is changed or added
  • PR title follows semantic commit guidelines
  • I acknowledge that all my contributions will be made under the project's license.

Notes:

added LFU Cache with tests and usage.

Copy link
Collaborator

@realstealthninja realstealthninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution! Let me know if this was for hacktoberfest

@realstealthninja realstealthninja added the awaiting modification Do not merge until modifications are made label Oct 4, 2024
@corvo-007
Copy link
Contributor Author

Thank you for your contribution! Let me know if this was for hacktoberfest

Yes, this is for Hacktoberfest. Thank you for reviewing my contribution.

@realstealthninja
Copy link
Collaborator

Thank you for your contribution! Let me know if this was for hacktoberfest

Yes, this is for Hacktoberfest. Thank you for reviewing my contribution.

youre very welcome. lets get this accepted soon 🚀

@corvo-007
Copy link
Contributor Author

@realstealthninja, what is the reason for making a non member function static?
And should I make test1() and test2() static as well?

@realstealthninja
Copy link
Collaborator

@realstealthninja, what is the reason for making a non member function static?
And should I make test1() and test2() static as well?

Static is used to hide the function from the global namespace.

Imo there shouldn't be 3 test function just one with comments delimiting the cases

@corvo-007
Copy link
Contributor Author

@realstealthninja, what is the reason for making a non member function static?
And should I make test1() and test2() static as well?

Static is used to hide the function from the global namespace.

Imo there shouldn't be 3 test function just one with comments delimiting the cases

Got it.

Copy link
Collaborator

@realstealthninja realstealthninja left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

@realstealthninja realstealthninja added approved Approved; waiting for merge and removed awaiting modification Do not merge until modifications are made labels Oct 7, 2024
@realstealthninja realstealthninja added the hacktoberfest-accepted Accepted to be counted towards Hacktoberfest label Oct 7, 2024
@realstealthninja realstealthninja merged commit 821d20c into TheAlgorithms:master Oct 7, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Approved; waiting for merge hacktoberfest hacktoberfest-accepted Accepted to be counted towards Hacktoberfest
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants