mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-04-14 02:30:40 +08:00
feat: add lru caching algorithm (#1557)
* updating DIRECTORY.md * feat: add lru caching algorithm * removing clang tidy warnings * updating DIRECTORY.md * clang-format and clang-tidy fixes forfcb50fb7* docs updated * clang-format and clang-tidy fixes foree18e3aa* using list instead of bits/stdc++.h * clang-format and clang-tidy fixes for19d09e85* Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * clang-format and clang-tidy fixes for4e223bc3* Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * clang-format and clang-tidy fixes for4bea23ef* using uint for non negative numbers * clang-format and clang-tidy fixes for87e7df55* Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * clang-format and clang-tidy fixes forb423fd4b* suggestions applied * clang-format and clang-tidy fixes fore3ba29eb* Update others/lru_cache.cpp Co-authored-by: David Leal <halfpacho@gmail.com> * clang-format and clang-tidy fixes forbdeee3daCo-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com> Co-authored-by: David Leal <halfpacho@gmail.com> Co-authored-by: Abhinn Mishra <49574460+mishraabhinn@users.noreply.github.com>
This commit is contained in:
@@ -24,7 +24,7 @@ class hash_chain {
|
||||
};
|
||||
|
||||
std::vector<std::shared_ptr<Node>> head; ///< array of nodes
|
||||
int _mod; ///< modulus of the class
|
||||
int _mod; ///< modulus of the class
|
||||
|
||||
public:
|
||||
/**
|
||||
@@ -164,7 +164,8 @@ int main() {
|
||||
case 3:
|
||||
std::cout << "Enter element to generate hash = " << std::endl;
|
||||
std::cin >> x;
|
||||
std::cout << "Hash of " << x << " is = " << mychain.hash(x) << std::endl;
|
||||
std::cout << "Hash of " << x << " is = " << mychain.hash(x)
|
||||
<< std::endl;
|
||||
break;
|
||||
case 4:
|
||||
mychain.display();
|
||||
|
||||
Reference in New Issue
Block a user