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 for fcb50fb7

* docs updated

* clang-format and clang-tidy fixes for ee18e3aa

* using list instead of bits/stdc++.h

* clang-format and clang-tidy fixes for 19d09e85

* 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 for 4e223bc3

* 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 for 4bea23ef

* using uint for non negative numbers

* clang-format and clang-tidy fixes for 87e7df55

* Update others/lru_cache.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* clang-format and clang-tidy fixes for b423fd4b

* suggestions applied

* clang-format and clang-tidy fixes for e3ba29eb

* Update others/lru_cache.cpp

Co-authored-by: David Leal <halfpacho@gmail.com>

* clang-format and clang-tidy fixes for bdeee3da

Co-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:
Nitin Sharma
2021-08-17 22:55:08 +05:30
committed by GitHub
parent 5dca8bc615
commit 446e0a5ce8
3 changed files with 272 additions and 2 deletions

View File

@@ -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();