Documentation for 821d20c33a

This commit is contained in:
realstealthninja
2024-10-07 13:34:57 +00:00
parent e37aaa437e
commit 969f0dcb73
244 changed files with 6091 additions and 1978 deletions

View File

@@ -0,0 +1,684 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.12.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: others::Cache::LFUCache&lt; K, V &gt; Class Template Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../jquery.js"></script>
<script type="text/javascript" src="../../dynsections.js"></script>
<script type="text/javascript" src="../../clipboard.js"></script>
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../navtreedata.js"></script>
<script type="text/javascript" src="../../navtree.js"></script>
<script type="text/javascript" src="../../resize.js"></script>
<script type="text/javascript" src="../../cookie.js"></script>
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="../../search/searchdata.js"></script>
<script type="text/javascript" src="../../search/search.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
jax: ["input/TeX","output/HTML-CSS"],
});
</script>
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
/* @license-end */
</script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() { codefold.init(1); });
/* @license-end */
</script>
<script type="text/javascript" src="../../menudata.js"></script>
<script type="text/javascript" src="../../menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function() {
initMenu('../../',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
/* @license-end */
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
$(function(){initNavTree('df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html','../../'); initResizable(true); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="../../db/d36/classothers_1_1_cache_1_1_l_f_u_cache-members.html">List of all members</a> </div>
<div class="headertitle"><div class="title">others::Cache::LFUCache&lt; K, V &gt; Class Template Reference</div></div>
</div><!--header-->
<div class="contents">
<p><a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html" title="LFUCache.">LFUCache</a>.
<a href="#details">More...</a></p>
<div class="dynheader">
Collaboration diagram for others::Cache::LFUCache&lt; K, V &gt;:</div>
<div class="dyncontent">
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../d4/d53/classothers_1_1_cache_1_1_l_f_u_cache__coll__graph.svg" width="100%" height="452"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div></div>
<center><span class="legend">[<a target="top" href="../../graph_legend.html">legend</a>]</span></center></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pub-methods" name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:affd7776c246caa2d0f92fd8616f6e5dc" id="r_affd7776c246caa2d0f92fd8616f6e5dc"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#affd7776c246caa2d0f92fd8616f6e5dc">LFUCache</a> (int <a class="el" href="#a3acc10e6bb67d9d9c4187f625723e6c5">_capacity</a>)</td></tr>
<tr class="memdesc:affd7776c246caa2d0f92fd8616f6e5dc"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor, Initialize with minFreq and _capacity. <br /></td></tr>
<tr class="separator:affd7776c246caa2d0f92fd8616f6e5dc"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af6f8e5a66a45436b490dfe015ff8866e" id="r_af6f8e5a66a45436b490dfe015ff8866e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af6f8e5a66a45436b490dfe015ff8866e">put</a> (K key, V value)</td></tr>
<tr class="memdesc:af6f8e5a66a45436b490dfe015ff8866e"><td class="mdescLeft">&#160;</td><td class="mdescRight">upsert a key-value pair <br /></td></tr>
<tr class="separator:af6f8e5a66a45436b490dfe015ff8866e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a58e37d3713f28d36abbb8cdf6c432781" id="r_a58e37d3713f28d36abbb8cdf6c432781"><td class="memItemLeft" align="right" valign="top">V&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a58e37d3713f28d36abbb8cdf6c432781">get</a> (K key)</td></tr>
<tr class="memdesc:a58e37d3713f28d36abbb8cdf6c432781"><td class="mdescLeft">&#160;</td><td class="mdescRight">get the value of the key-value pair if exists <br /></td></tr>
<tr class="separator:a58e37d3713f28d36abbb8cdf6c432781"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adbfb2ef7358423fdf1f49d410f55f195" id="r_adbfb2ef7358423fdf1f49d410f55f195"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#adbfb2ef7358423fdf1f49d410f55f195">size</a> () const</td></tr>
<tr class="memdesc:adbfb2ef7358423fdf1f49d410f55f195"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the number of items present in the cache. <br /></td></tr>
<tr class="separator:adbfb2ef7358423fdf1f49d410f55f195"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac27c9076377cbed2a2acc45a189fed2c" id="r_ac27c9076377cbed2a2acc45a189fed2c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac27c9076377cbed2a2acc45a189fed2c">capacity</a> () const</td></tr>
<tr class="memdesc:ac27c9076377cbed2a2acc45a189fed2c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the total capacity of the cache. <br /></td></tr>
<tr class="separator:ac27c9076377cbed2a2acc45a189fed2c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a68e1be0a3e0a6478aa35f04000e0e9b0" id="r_a68e1be0a3e0a6478aa35f04000e0e9b0"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a68e1be0a3e0a6478aa35f04000e0e9b0">empty</a> () const</td></tr>
<tr class="memdesc:a68e1be0a3e0a6478aa35f04000e0e9b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">returns true if the cache is empty, false otherwise. <br /></td></tr>
<tr class="separator:a68e1be0a3e0a6478aa35f04000e0e9b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8857531ecc8ed2e36868e267148eff36" id="r_a8857531ecc8ed2e36868e267148eff36"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8857531ecc8ed2e36868e267148eff36">~LFUCache</a> ()</td></tr>
<tr class="memdesc:a8857531ecc8ed2e36868e267148eff36"><td class="mdescLeft">&#160;</td><td class="mdescRight">destructs the cache, iterates on the map and deletes every node present in the cache. <br /></td></tr>
<tr class="separator:a8857531ecc8ed2e36868e267148eff36"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-methods" name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr class="memitem:adad4ab43141fb8ba43facd3a71e07047" id="r_adad4ab43141fb8ba43facd3a71e07047"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#adad4ab43141fb8ba43facd3a71e07047">push</a> (int freq, <a class="el" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode</a>&lt; K, V &gt; *<a class="el" href="../../d5/da1/structnode.html">node</a>)</td></tr>
<tr class="memdesc:adad4ab43141fb8ba43facd3a71e07047"><td class="mdescLeft">&#160;</td><td class="mdescRight">push the node at first position in the linked list of given frequency <br /></td></tr>
<tr class="separator:adad4ab43141fb8ba43facd3a71e07047"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a16a25c102554c5653721a5112ef676c9" id="r_a16a25c102554c5653721a5112ef676c9"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a16a25c102554c5653721a5112ef676c9">increase_frequency</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair</a>&lt; <a class="el" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode</a>&lt; K, V &gt; *, int &gt; &amp;p_node)</td></tr>
<tr class="memdesc:a16a25c102554c5653721a5112ef676c9"><td class="mdescLeft">&#160;</td><td class="mdescRight">increase the frequency of node and push it in the respective list. <br /></td></tr>
<tr class="separator:a16a25c102554c5653721a5112ef676c9"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab3561ab204754295199f9566924f7e69" id="r_ab3561ab204754295199f9566924f7e69"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ab3561ab204754295199f9566924f7e69">pop</a> ()</td></tr>
<tr class="memdesc:ab3561ab204754295199f9566924f7e69"><td class="mdescLeft">&#160;</td><td class="mdescRight">pop the last node in the least frequently used linked list <br /></td></tr>
<tr class="separator:ab3561ab204754295199f9566924f7e69"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="pri-attribs" name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr class="memitem:ac7684879e2e5da3d8bc5b1699ee42d35" id="r_ac7684879e2e5da3d8bc5b1699ee42d35"><td class="memItemLeft" align="right" valign="top"><a id="ac7684879e2e5da3d8bc5b1699ee42d35" name="ac7684879e2e5da3d8bc5b1699ee42d35"></a>
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/unordered_map.html">std::unordered_map</a>&lt; K, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair</a>&lt; <a class="el" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode</a>&lt; K, V &gt; *, int &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>node_map</b></td></tr>
<tr class="memdesc:ac7684879e2e5da3d8bc5b1699ee42d35"><td class="mdescLeft">&#160;</td><td class="mdescRight">maps the key to the node address and frequency <br /></td></tr>
<tr class="separator:ac7684879e2e5da3d8bc5b1699ee42d35"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba5d59d0f6ab0c0d30a92551ca5a05f2" id="r_aba5d59d0f6ab0c0d30a92551ca5a05f2"><td class="memItemLeft" align="right" valign="top"><a id="aba5d59d0f6ab0c0d30a92551ca5a05f2" name="aba5d59d0f6ab0c0d30a92551ca5a05f2"></a>
<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/unordered_map.html">std::unordered_map</a>&lt; int, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair</a>&lt; <a class="el" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode</a>&lt; K, V &gt; *, <a class="el" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode</a>&lt; K, V &gt; * &gt; &gt;&#160;</td><td class="memItemRight" valign="bottom"><b>freq_map</b></td></tr>
<tr class="memdesc:aba5d59d0f6ab0c0d30a92551ca5a05f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">maps the frequency to doubly linked list <br /></td></tr>
<tr class="separator:aba5d59d0f6ab0c0d30a92551ca5a05f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6de844d1589a809239cc07752f311285" id="r_a6de844d1589a809239cc07752f311285"><td class="memItemLeft" align="right" valign="top"><a id="a6de844d1589a809239cc07752f311285" name="a6de844d1589a809239cc07752f311285"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>minFreq</b></td></tr>
<tr class="memdesc:a6de844d1589a809239cc07752f311285"><td class="mdescLeft">&#160;</td><td class="mdescRight">minimum frequency in the cache <br /></td></tr>
<tr class="separator:a6de844d1589a809239cc07752f311285"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3acc10e6bb67d9d9c4187f625723e6c5" id="r_a3acc10e6bb67d9d9c4187f625723e6c5"><td class="memItemLeft" align="right" valign="top"><a id="a3acc10e6bb67d9d9c4187f625723e6c5" name="a3acc10e6bb67d9d9c4187f625723e6c5"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>_capacity</b></td></tr>
<tr class="memdesc:a3acc10e6bb67d9d9c4187f625723e6c5"><td class="mdescLeft">&#160;</td><td class="mdescRight">maximum capacity of the cache <br /></td></tr>
<tr class="separator:a3acc10e6bb67d9d9c4187f625723e6c5"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><div class="compoundTemplParams">template&lt;typename K, typename V&gt;<br />
class others::Cache::LFUCache&lt; K, V &gt;</div><p><a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html" title="LFUCache.">LFUCache</a>. </p>
<dl class="tparams"><dt>Template Parameters</dt><dd>
<table class="tparams">
<tr><td class="paramname">K</td><td>type of key in the LFU </td></tr>
<tr><td class="paramname">V</td><td>type of value in the LFU </td></tr>
</table>
</dd>
</dl>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="affd7776c246caa2d0f92fd8616f6e5dc" name="affd7776c246caa2d0f92fd8616f6e5dc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#affd7776c246caa2d0f92fd8616f6e5dc">&#9670;&#160;</a></span>LFUCache()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::LFUCache </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>_capacity</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Constructor, Initialize with minFreq and _capacity. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">_capacity</td><td>Total capacity of the cache. </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><span class="lineno"> 78</span>: <a class="code hl_variable" href="#a6de844d1589a809239cc07752f311285">minFreq</a>(0), <a class="code hl_variable" href="#a3acc10e6bb67d9d9c4187f625723e6c5">_capacity</a>(<a class="code hl_variable" href="#a3acc10e6bb67d9d9c4187f625723e6c5">_capacity</a>) {}</div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_f_u_cache_html_a3acc10e6bb67d9d9c4187f625723e6c5"><div class="ttname"><a href="#a3acc10e6bb67d9d9c4187f625723e6c5">others::Cache::LFUCache::_capacity</a></div><div class="ttdeci">int _capacity</div><div class="ttdoc">maximum capacity of the cache</div><div class="ttdef"><b>Definition</b> lfu_cache.cpp:71</div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_f_u_cache_html_a6de844d1589a809239cc07752f311285"><div class="ttname"><a href="#a6de844d1589a809239cc07752f311285">others::Cache::LFUCache::minFreq</a></div><div class="ttdeci">int minFreq</div><div class="ttdoc">minimum frequency in the cache</div><div class="ttdef"><b>Definition</b> lfu_cache.cpp:70</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="a8857531ecc8ed2e36868e267148eff36" name="a8857531ecc8ed2e36868e267148eff36"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8857531ecc8ed2e36868e267148eff36">&#9670;&#160;</a></span>~LFUCache()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::~<a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">LFUCache</a> </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>destructs the cache, iterates on the map and deletes every node present in the cache. </p>
<div class="fragment"><div class="line"><span class="lineno"> 235</span> {</div>
<div class="line"><span class="lineno"> 236</span> <span class="keyword">auto</span> it = <a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>.begin();</div>
<div class="line"><span class="lineno"> 237</span> <span class="keywordflow">while</span> (it != <a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>.end()) {</div>
<div class="line"><span class="lineno"> 238</span> <span class="keyword">delete</span> it-&gt;second.first;</div>
<div class="line"><span class="lineno"> 239</span> ++it;</div>
<div class="line"><span class="lineno"> 240</span> }</div>
<div class="line"><span class="lineno"> 241</span> }</div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_f_u_cache_html_ac7684879e2e5da3d8bc5b1699ee42d35"><div class="ttname"><a href="#ac7684879e2e5da3d8bc5b1699ee42d35">others::Cache::LFUCache::node_map</a></div><div class="ttdeci">std::unordered_map&lt; K, std::pair&lt; CacheNode&lt; K, V &gt; *, int &gt; &gt; node_map</div><div class="ttdoc">maps the key to the node address and frequency</div><div class="ttdef"><b>Definition</b> lfu_cache.cpp:66</div></div>
</div><!-- fragment -->
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="ac27c9076377cbed2a2acc45a189fed2c" name="ac27c9076377cbed2a2acc45a189fed2c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac27c9076377cbed2a2acc45a189fed2c">&#9670;&#160;</a></span>capacity()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::capacity </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the total capacity of the cache. </p>
<dl class="section return"><dt>Returns</dt><dd>Total capacity of the cache </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 223</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="#a3acc10e6bb67d9d9c4187f625723e6c5">_capacity</a>; }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a68e1be0a3e0a6478aa35f04000e0e9b0" name="a68e1be0a3e0a6478aa35f04000e0e9b0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a68e1be0a3e0a6478aa35f04000e0e9b0">&#9670;&#160;</a></span>empty()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool <a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::empty </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>returns true if the cache is empty, false otherwise. </p>
<dl class="section return"><dt>Returns</dt><dd>true if the cache is empty, false otherwise. </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 229</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>.empty(); }</div>
</div><!-- fragment -->
</div>
</div>
<a id="a58e37d3713f28d36abbb8cdf6c432781" name="a58e37d3713f28d36abbb8cdf6c432781"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a58e37d3713f28d36abbb8cdf6c432781">&#9670;&#160;</a></span>get()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">V <a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::get </td>
<td>(</td>
<td class="paramtype">K</td> <td class="paramname"><span class="paramname"><em>key</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>get the value of the key-value pair if exists </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">key</td><td>key of the key-value pair </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the value mapped to the given key </dd></dl>
<dl class="exception"><dt>Exceptions</dt><dd>
<table class="exception">
<tr><td class="paramname">exception</td><td>is thrown if the key is not present in the cache </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><span class="lineno"> 202</span> {</div>
<div class="line"><span class="lineno"> 203</span> <span class="keywordflow">if</span> (!<a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>.count(key)) {</div>
<div class="line"><span class="lineno"> 204</span> <span class="keywordflow">throw</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/error/runtime_error.html">std::runtime_error</a>(<span class="stringliteral">&quot;key is not present in the cache&quot;</span>);</div>
<div class="line"><span class="lineno"> 205</span> }</div>
<div class="line"><span class="lineno"> 206</span> </div>
<div class="line"><span class="lineno"> 207</span> <span class="comment">// increase the frequency and return the value</span></div>
<div class="line"><span class="lineno"> 208</span> V value = <a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>[key].first-&gt;data.second;</div>
<div class="line"><span class="lineno"> 209</span> <a class="code hl_function" href="#a16a25c102554c5653721a5112ef676c9">increase_frequency</a>(<a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>[key]);</div>
<div class="line"><span class="lineno"> 210</span> <span class="keywordflow">return</span> value;</div>
<div class="line"><span class="lineno"> 211</span> }</div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_f_u_cache_html_a16a25c102554c5653721a5112ef676c9"><div class="ttname"><a href="#a16a25c102554c5653721a5112ef676c9">others::Cache::LFUCache::increase_frequency</a></div><div class="ttdeci">void increase_frequency(std::pair&lt; CacheNode&lt; K, V &gt; *, int &gt; &amp;p_node)</div><div class="ttdoc">increase the frequency of node and push it in the respective list.</div><div class="ttdef"><b>Definition</b> lfu_cache.cpp:109</div></div>
<div class="ttc" id="aruntime_error_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/error/runtime_error.html">std::runtime_error</a></div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache_a58e37d3713f28d36abbb8cdf6c432781_cgraph.svg" width="656" height="52"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="a16a25c102554c5653721a5112ef676c9" name="a16a25c102554c5653721a5112ef676c9"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a16a25c102554c5653721a5112ef676c9">&#9670;&#160;</a></span>increase_frequency()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::increase_frequency </td>
<td>(</td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair</a>&lt; <a class="el" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode</a>&lt; K, V &gt; *, int &gt; &amp;</td> <td class="paramname"><span class="paramname"><em>p_node</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>increase the frequency of node and push it in the respective list. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">p_node</td><td>the node to be updated </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><span class="lineno"> 109</span> {</div>
<div class="line"><span class="lineno"> 110</span> CacheNode&lt;K, V&gt; *<a class="code hl_class" href="../../d5/da1/structnode.html">node</a> = p_node.first;</div>
<div class="line"><span class="lineno"> 111</span> <span class="keywordtype">int</span> freq = p_node.second;</div>
<div class="line"><span class="lineno"> 112</span> </div>
<div class="line"><span class="lineno"> 113</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair&lt;CacheNode&lt;K, V&gt;</a> *, CacheNode&lt;K, V&gt; *&gt; &amp;p = <a class="code hl_variable" href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">freq_map</a>[freq];</div>
<div class="line"><span class="lineno"> 114</span> </div>
<div class="line"><span class="lineno"> 115</span> <span class="comment">// if the given node is the only node in the list,</span></div>
<div class="line"><span class="lineno"> 116</span> <span class="comment">// then erase the frequency from map</span></div>
<div class="line"><span class="lineno"> 117</span> <span class="comment">// and increase minFreq by 1.</span></div>
<div class="line"><span class="lineno"> 118</span> <span class="keywordflow">if</span> (p.first == <a class="code hl_class" href="../../d5/da1/structnode.html">node</a> &amp;&amp; p.second == <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>) {</div>
<div class="line"><span class="lineno"> 119</span> <a class="code hl_variable" href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">freq_map</a>.erase(freq);</div>
<div class="line"><span class="lineno"> 120</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#a6de844d1589a809239cc07752f311285">minFreq</a> == freq) {</div>
<div class="line"><span class="lineno"> 121</span> <a class="code hl_variable" href="#a6de844d1589a809239cc07752f311285">minFreq</a> = freq + 1;</div>
<div class="line"><span class="lineno"> 122</span> }</div>
<div class="line"><span class="lineno"> 123</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 124</span> <span class="comment">// remove the given node from current freq linked list</span></div>
<div class="line"><span class="lineno"> 125</span> CacheNode&lt;K, V&gt; *<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a> = <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>-&gt;prev;</div>
<div class="line"><span class="lineno"> 126</span> CacheNode&lt;K, V&gt; *<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a> = <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>-&gt;next;</div>
<div class="line"><span class="lineno"> 127</span> <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>-&gt;prev = <span class="keyword">nullptr</span>;</div>
<div class="line"><span class="lineno"> 128</span> <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>-&gt;next = <span class="keyword">nullptr</span>;</div>
<div class="line"><span class="lineno"> 129</span> </div>
<div class="line"><span class="lineno"> 130</span> <span class="keywordflow">if</span> (prev) {</div>
<div class="line"><span class="lineno"> 131</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>-&gt;next = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a>;</div>
<div class="line"><span class="lineno"> 132</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 133</span> p.first = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a>;</div>
<div class="line"><span class="lineno"> 134</span> }</div>
<div class="line"><span class="lineno"> 135</span> </div>
<div class="line"><span class="lineno"> 136</span> <span class="keywordflow">if</span> (next) {</div>
<div class="line"><span class="lineno"> 137</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/next.html">next</a>-&gt;prev = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>;</div>
<div class="line"><span class="lineno"> 138</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 139</span> p.second = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/iterator/prev.html">prev</a>;</div>
<div class="line"><span class="lineno"> 140</span> }</div>
<div class="line"><span class="lineno"> 141</span> }</div>
<div class="line"><span class="lineno"> 142</span> <a class="code hl_function" href="#adad4ab43141fb8ba43facd3a71e07047">push</a>(freq + 1, <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>);</div>
<div class="line"><span class="lineno"> 143</span> ++p_node.second;</div>
<div class="line"><span class="lineno"> 144</span> }</div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_f_u_cache_html_aba5d59d0f6ab0c0d30a92551ca5a05f2"><div class="ttname"><a href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">others::Cache::LFUCache::freq_map</a></div><div class="ttdeci">std::unordered_map&lt; int, std::pair&lt; CacheNode&lt; K, V &gt; *, CacheNode&lt; K, V &gt; * &gt; &gt; freq_map</div><div class="ttdoc">maps the frequency to doubly linked list</div><div class="ttdef"><b>Definition</b> lfu_cache.cpp:68</div></div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_f_u_cache_html_adad4ab43141fb8ba43facd3a71e07047"><div class="ttname"><a href="#adad4ab43141fb8ba43facd3a71e07047">others::Cache::LFUCache::push</a></div><div class="ttdeci">void push(int freq, CacheNode&lt; K, V &gt; *node)</div><div class="ttdoc">push the node at first position in the linked list of given frequency</div><div class="ttdef"><b>Definition</b> lfu_cache.cpp:88</div></div>
<div class="ttc" id="anext_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/next.html">std::next</a></div><div class="ttdeci">T next(T... args)</div></div>
<div class="ttc" id="apair_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair</a></div></div>
<div class="ttc" id="aprev_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/iterator/prev.html">std::prev</a></div><div class="ttdeci">T prev(T... args)</div></div>
<div class="ttc" id="astructnode_html"><div class="ttname"><a href="../../d5/da1/structnode.html">node</a></div><div class="ttdef"><b>Definition</b> binary_search_tree.cpp:11</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache_a16a25c102554c5653721a5112ef676c9_cgraph.svg" width="408" height="52"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div>
</div>
<a id="ab3561ab204754295199f9566924f7e69" name="ab3561ab204754295199f9566924f7e69"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab3561ab204754295199f9566924f7e69">&#9670;&#160;</a></span>pop()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::pop </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>pop the last node in the least frequently used linked list </p>
<div class="fragment"><div class="line"><span class="lineno"> 149</span> {</div>
<div class="line"><span class="lineno"> 150</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair&lt;CacheNode&lt;K, V&gt;</a> *, CacheNode&lt;K, V&gt; *&gt; &amp;p = <a class="code hl_variable" href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">freq_map</a>[<a class="code hl_variable" href="#a6de844d1589a809239cc07752f311285">minFreq</a>];</div>
<div class="line"><span class="lineno"> 151</span> </div>
<div class="line"><span class="lineno"> 152</span> <span class="comment">// if there is only one node</span></div>
<div class="line"><span class="lineno"> 153</span> <span class="comment">// remove the node and erase</span></div>
<div class="line"><span class="lineno"> 154</span> <span class="comment">// the frequency from freq_map</span></div>
<div class="line"><span class="lineno"> 155</span> <span class="keywordflow">if</span> (p.first == p.second) {</div>
<div class="line"><span class="lineno"> 156</span> <span class="keyword">delete</span> p.first;</div>
<div class="line"><span class="lineno"> 157</span> <a class="code hl_variable" href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">freq_map</a>.erase(<a class="code hl_variable" href="#a6de844d1589a809239cc07752f311285">minFreq</a>);</div>
<div class="line"><span class="lineno"> 158</span> <span class="keywordflow">return</span>;</div>
<div class="line"><span class="lineno"> 159</span> }</div>
<div class="line"><span class="lineno"> 160</span> </div>
<div class="line"><span class="lineno"> 161</span> <span class="comment">// remove the last node in the linked list</span></div>
<div class="line"><span class="lineno"> 162</span> CacheNode&lt;K, V&gt; *temp = p.second;</div>
<div class="line"><span class="lineno"> 163</span> p.second = temp-&gt;prev;</div>
<div class="line"><span class="lineno"> 164</span> p.second-&gt;next = <span class="keyword">nullptr</span>;</div>
<div class="line"><span class="lineno"> 165</span> <span class="keyword">delete</span> temp;</div>
<div class="line"><span class="lineno"> 166</span> }</div>
</div><!-- fragment -->
</div>
</div>
<a id="adad4ab43141fb8ba43facd3a71e07047" name="adad4ab43141fb8ba43facd3a71e07047"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adad4ab43141fb8ba43facd3a71e07047">&#9670;&#160;</a></span>push()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::push </td>
<td>(</td>
<td class="paramtype">int</td> <td class="paramname"><span class="paramname"><em>freq</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="../../de/d21/classothers_1_1_cache_1_1_d___node.html">CacheNode</a>&lt; K, V &gt; *</td> <td class="paramname"><span class="paramname"><em>node</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">private</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>push the node at first position in the linked list of given frequency </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">freq</td><td>the frequency mapping to the linked list where node should be pushed. </td></tr>
<tr><td class="paramname">node</td><td>node to be pushed to the linked list. </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><span class="lineno"> 88</span> {</div>
<div class="line"><span class="lineno"> 89</span> <span class="comment">// if freq is not present, then make a new list with node as the head as</span></div>
<div class="line"><span class="lineno"> 90</span> <span class="comment">// well as tail.</span></div>
<div class="line"><span class="lineno"> 91</span> <span class="keywordflow">if</span> (!<a class="code hl_variable" href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">freq_map</a>.count(freq)) {</div>
<div class="line"><span class="lineno"> 92</span> <a class="code hl_variable" href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">freq_map</a>[freq] = {<a class="code hl_typedef" href="../../d8/dee/avltree_8cpp.html#a74f0cf18a0e5b832d9994e2f2d022287">node</a>, <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>};</div>
<div class="line"><span class="lineno"> 93</span> <span class="keywordflow">return</span>;</div>
<div class="line"><span class="lineno"> 94</span> }</div>
<div class="line"><span class="lineno"> 95</span> </div>
<div class="line"><span class="lineno"> 96</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair&lt;CacheNode&lt;K, V&gt;</a> *, CacheNode&lt;K, V&gt; *&gt; &amp;p = <a class="code hl_variable" href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">freq_map</a>[freq];</div>
<div class="line"><span class="lineno"> 97</span> </div>
<div class="line"><span class="lineno"> 98</span> <span class="comment">// insert the node at the beginning of the linked list and update the</span></div>
<div class="line"><span class="lineno"> 99</span> <span class="comment">// head.</span></div>
<div class="line"><span class="lineno"> 100</span> p.first-&gt;prev = <a class="code hl_typedef" href="../../d8/dee/avltree_8cpp.html#a74f0cf18a0e5b832d9994e2f2d022287">node</a>;</div>
<div class="line"><span class="lineno"> 101</span> <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>-&gt;next = p.first;</div>
<div class="line"><span class="lineno"> 102</span> p.first = <a class="code hl_typedef" href="../../d8/dee/avltree_8cpp.html#a74f0cf18a0e5b832d9994e2f2d022287">node</a>;</div>
<div class="line"><span class="lineno"> 103</span> }</div>
<div class="ttc" id="aavltree_8cpp_html_a74f0cf18a0e5b832d9994e2f2d022287"><div class="ttname"><a href="../../d8/dee/avltree_8cpp.html#a74f0cf18a0e5b832d9994e2f2d022287">node</a></div><div class="ttdeci">struct node { int data; int height; struct node *left; struct node *right;} node</div><div class="ttdoc">for std::queue</div><div class="ttdef"><b>Definition</b> avltree.cpp:13</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="af6f8e5a66a45436b490dfe015ff8866e" name="af6f8e5a66a45436b490dfe015ff8866e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af6f8e5a66a45436b490dfe015ff8866e">&#9670;&#160;</a></span>put()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void <a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::put </td>
<td>(</td>
<td class="paramtype">K</td> <td class="paramname"><span class="paramname"><em>key</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">V</td> <td class="paramname"><span class="paramname"><em>value</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>upsert a key-value pair </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">key</td><td>key of the key-value pair </td></tr>
<tr><td class="paramname">value</td><td>value of the key-value pair </td></tr>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><span class="lineno"> 174</span> {</div>
<div class="line"><span class="lineno"> 175</span> <span class="comment">// update the value if key already exists</span></div>
<div class="line"><span class="lineno"> 176</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>.count(key)) {</div>
<div class="line"><span class="lineno"> 177</span> <a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>[key].first-&gt;data.second = value;</div>
<div class="line"><span class="lineno"> 178</span> <a class="code hl_function" href="#a16a25c102554c5653721a5112ef676c9">increase_frequency</a>(<a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>[key]);</div>
<div class="line"><span class="lineno"> 179</span> <span class="keywordflow">return</span>;</div>
<div class="line"><span class="lineno"> 180</span> }</div>
<div class="line"><span class="lineno"> 181</span> </div>
<div class="line"><span class="lineno"> 182</span> <span class="comment">// if the cache is full</span></div>
<div class="line"><span class="lineno"> 183</span> <span class="comment">// remove the least frequently used item</span></div>
<div class="line"><span class="lineno"> 184</span> <span class="keywordflow">if</span> (<a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>.size() == <a class="code hl_variable" href="#a3acc10e6bb67d9d9c4187f625723e6c5">_capacity</a>) {</div>
<div class="line"><span class="lineno"> 185</span> <a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>.erase(<a class="code hl_variable" href="#aba5d59d0f6ab0c0d30a92551ca5a05f2">freq_map</a>[<a class="code hl_variable" href="#a6de844d1589a809239cc07752f311285">minFreq</a>].second-&gt;data.first);</div>
<div class="line"><span class="lineno"> 186</span> <a class="code hl_function" href="#ab3561ab204754295199f9566924f7e69">pop</a>();</div>
<div class="line"><span class="lineno"> 187</span> }</div>
<div class="line"><span class="lineno"> 188</span> </div>
<div class="line"><span class="lineno"> 189</span> <span class="comment">// insert the new node and set minFreq to 1</span></div>
<div class="line"><span class="lineno"> 190</span> CacheNode&lt;K, V&gt; *<a class="code hl_class" href="../../d5/da1/structnode.html">node</a> = <span class="keyword">new</span> CacheNode&lt;K, V&gt;({key, value});</div>
<div class="line"><span class="lineno"> 191</span> <a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>[key] = {<a class="code hl_typedef" href="../../d8/dee/avltree_8cpp.html#a74f0cf18a0e5b832d9994e2f2d022287">node</a>, 1};</div>
<div class="line"><span class="lineno"> 192</span> <a class="code hl_variable" href="#a6de844d1589a809239cc07752f311285">minFreq</a> = 1;</div>
<div class="line"><span class="lineno"> 193</span> <a class="code hl_function" href="#adad4ab43141fb8ba43facd3a71e07047">push</a>(1, <a class="code hl_class" href="../../d5/da1/structnode.html">node</a>);</div>
<div class="line"><span class="lineno"> 194</span> }</div>
<div class="ttc" id="aclassothers_1_1_cache_1_1_l_f_u_cache_html_ab3561ab204754295199f9566924f7e69"><div class="ttname"><a href="#ab3561ab204754295199f9566924f7e69">others::Cache::LFUCache::pop</a></div><div class="ttdeci">void pop()</div><div class="ttdoc">pop the last node in the least frequently used linked list</div><div class="ttdef"><b>Definition</b> lfu_cache.cpp:149</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><div class="zoom"><iframe scrolling="no" frameborder="0" src="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache_af6f8e5a66a45436b490dfe015ff8866e_cgraph.svg" width="100%" height="414"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div></div>
</div>
</div>
</div>
<a id="adbfb2ef7358423fdf1f49d410f55f195" name="adbfb2ef7358423fdf1f49d410f55f195"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adbfb2ef7358423fdf1f49d410f55f195">&#9670;&#160;</a></span>size()</h2>
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template&lt;typename K , typename V &gt; </div>
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int <a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">others::Cache::LFUCache</a>&lt; K, V &gt;::size </td>
<td>(</td>
<td class="paramname"><span class="paramname"><em></em></span></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Returns the number of items present in the cache. </p>
<dl class="section return"><dt>Returns</dt><dd>number of items in the cache </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 217</span>{ <span class="keywordflow">return</span> <a class="code hl_variable" href="#ac7684879e2e5da3d8bc5b1699ee42d35">node_map</a>.size(); }</div>
</div><!-- fragment -->
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li>others/<a class="el" href="../../d9/d65/lfu__cache_8cpp.html">lfu_cache.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="../../d0/d6f/namespaceothers.html">others</a></li><li class="navelem"><a class="el" href="../../db/dde/namespaceothers_1_1_cache.html">Cache</a></li><li class="navelem"><a class="el" href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html">LFUCache</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
</ul>
</div>
</body>
</html>

View File

@@ -0,0 +1,17 @@
var classothers_1_1_cache_1_1_l_f_u_cache =
[
[ "LFUCache", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#affd7776c246caa2d0f92fd8616f6e5dc", null ],
[ "~LFUCache", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a8857531ecc8ed2e36868e267148eff36", null ],
[ "capacity", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#ac27c9076377cbed2a2acc45a189fed2c", null ],
[ "empty", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a68e1be0a3e0a6478aa35f04000e0e9b0", null ],
[ "get", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a58e37d3713f28d36abbb8cdf6c432781", null ],
[ "increase_frequency", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a16a25c102554c5653721a5112ef676c9", null ],
[ "pop", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#ab3561ab204754295199f9566924f7e69", null ],
[ "push", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047", null ],
[ "put", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#af6f8e5a66a45436b490dfe015ff8866e", null ],
[ "size", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adbfb2ef7358423fdf1f49d410f55f195", null ],
[ "_capacity", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a3acc10e6bb67d9d9c4187f625723e6c5", null ],
[ "freq_map", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#aba5d59d0f6ab0c0d30a92551ca5a05f2", null ],
[ "minFreq", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a6de844d1589a809239cc07752f311285", null ],
[ "node_map", "df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#ac7684879e2e5da3d8bc5b1699ee42d35", null ]
];

View File

@@ -0,0 +1,5 @@
<map id="others::Cache::LFUCache::increase_frequency" name="others::Cache::LFUCache::increase_frequency">
<area shape="rect" id="Node000001" title="increase the frequency of node and push it in the respective list." alt="" coords="5,5,180,46"/>
<area shape="rect" id="Node000002" href="$df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" title="push the node at first position in the linked list of given frequency" alt="" coords="228,5,402,46"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="180,23,212,23,212,28,180,28"/>
</map>

View File

@@ -0,0 +1 @@
136e5b2fde508fd9779a8e62e4f72912

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.1 (20240910.0053)
-->
<!-- Title: others::Cache::LFUCache::increase_frequency Pages: 1 -->
<svg width="306pt" height="39pt"
viewBox="0.00 0.00 305.50 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
<title>others::Cache::LFUCache::increase_frequency</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="increase the frequency of node and push it in the respective list.">
<polygon fill="#999999" stroke="#666666" points="130.75,-30.5 0,-30.5 0,0 130.75,0 130.75,-30.5"/>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="65.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::increase_frequency</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" target="_top" xlink:title="push the node at first position in the linked list of given frequency">
<polygon fill="white" stroke="#666666" points="297.5,-30.5 166.75,-30.5 166.75,0 297.5,0 297.5,-30.5"/>
<text text-anchor="start" x="174.75" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="232.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::push</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M131.02,-15.25C138.92,-15.25 147.05,-15.25 155.1,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="154.89,-18.75 164.89,-15.25 154.89,-11.75 154.89,-18.75"/>
</a>
</g>
</g>
</g>
</svg>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.1 (20240910.0053)
-->
<!-- Title: others::Cache::LFUCache::increase_frequency Pages: 1 -->
<svg width="306pt" height="39pt"
viewBox="0.00 0.00 305.50 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
<title>others::Cache::LFUCache::increase_frequency</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="increase the frequency of node and push it in the respective list.">
<polygon fill="#999999" stroke="#666666" points="130.75,-30.5 0,-30.5 0,0 130.75,0 130.75,-30.5"/>
<text text-anchor="start" x="8" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="65.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::increase_frequency</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" target="_top" xlink:title="push the node at first position in the linked list of given frequency">
<polygon fill="white" stroke="#666666" points="297.5,-30.5 166.75,-30.5 166.75,0 297.5,0 297.5,-30.5"/>
<text text-anchor="start" x="174.75" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="232.12" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::push</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M131.02,-15.25C138.92,-15.25 147.05,-15.25 155.1,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="154.89,-18.75 164.89,-15.25 154.89,-11.75 154.89,-18.75"/>
</a>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1,7 @@
<map id="others::Cache::LFUCache::get" name="others::Cache::LFUCache::get">
<area shape="rect" id="Node000001" title="get the value of the key&#45;value pair if exists" alt="" coords="5,13,206,38"/>
<area shape="rect" id="Node000002" href="$df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a16a25c102554c5653721a5112ef676c9" title="increase the frequency of node and push it in the respective list." alt="" coords="254,5,428,46"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="206,23,238,23,238,28,206,28"/>
<area shape="rect" id="Node000003" href="$df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" title="push the node at first position in the linked list of given frequency" alt="" coords="476,5,650,46"/>
<area shape="poly" id="edge2_Node000002_Node000003" title=" " alt="" coords="428,23,460,23,460,28,428,28"/>
</map>

View File

@@ -0,0 +1 @@
a478dd2129b44698d51017d165ed8e6b

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.1 (20240910.0053)
-->
<!-- Title: others::Cache::LFUCache::get Pages: 1 -->
<svg width="492pt" height="39pt"
viewBox="0.00 0.00 491.75 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
<title>others::Cache::LFUCache::get</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="get the value of the key&#45;value pair if exists">
<polygon fill="#999999" stroke="#666666" points="150.25,-24.88 0,-24.88 0,-5.63 150.25,-5.63 150.25,-24.88"/>
<text text-anchor="middle" x="75.12" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache::get</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a16a25c102554c5653721a5112ef676c9" target="_top" xlink:title="increase the frequency of node and push it in the respective list.">
<polygon fill="white" stroke="#666666" points="317,-30.5 186.25,-30.5 186.25,0 317,0 317,-30.5"/>
<text text-anchor="start" x="194.25" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="251.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::increase_frequency</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M150.63,-15.25C158.54,-15.25 166.59,-15.25 174.51,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="174.48,-18.75 184.48,-15.25 174.48,-11.75 174.48,-18.75"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" target="_top" xlink:title="push the node at first position in the linked list of given frequency">
<polygon fill="white" stroke="#666666" points="483.75,-30.5 353,-30.5 353,0 483.75,0 483.75,-30.5"/>
<text text-anchor="start" x="361" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="418.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::push</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2_Node000002_Node000003" class="edge">
<title>Node2&#45;&gt;Node3</title>
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M317.27,-15.25C325.17,-15.25 333.3,-15.25 341.35,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="341.14,-18.75 351.14,-15.25 341.14,-11.75 341.14,-18.75"/>
</a>
</g>
</g>
</g>
</svg>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.1 (20240910.0053)
-->
<!-- Title: others::Cache::LFUCache::get Pages: 1 -->
<svg width="492pt" height="39pt"
viewBox="0.00 0.00 491.75 38.50" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 34.5)">
<title>others::Cache::LFUCache::get</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="get the value of the key&#45;value pair if exists">
<polygon fill="#999999" stroke="#666666" points="150.25,-24.88 0,-24.88 0,-5.63 150.25,-5.63 150.25,-24.88"/>
<text text-anchor="middle" x="75.12" y="-11.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache::get</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a16a25c102554c5653721a5112ef676c9" target="_top" xlink:title="increase the frequency of node and push it in the respective list.">
<polygon fill="white" stroke="#666666" points="317,-30.5 186.25,-30.5 186.25,0 317,0 317,-30.5"/>
<text text-anchor="start" x="194.25" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="251.62" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::increase_frequency</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M150.63,-15.25C158.54,-15.25 166.59,-15.25 174.51,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="174.48,-18.75 184.48,-15.25 174.48,-11.75 174.48,-18.75"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" target="_top" xlink:title="push the node at first position in the linked list of given frequency">
<polygon fill="white" stroke="#666666" points="483.75,-30.5 353,-30.5 353,0 483.75,0 483.75,-30.5"/>
<text text-anchor="start" x="361" y="-17" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="418.38" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">::push</text>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2_Node000002_Node000003" class="edge">
<title>Node2&#45;&gt;Node3</title>
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M317.27,-15.25C325.17,-15.25 333.3,-15.25 341.35,-15.25"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="341.14,-18.75 351.14,-15.25 341.14,-11.75 341.14,-18.75"/>
</a>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@@ -0,0 +1,10 @@
<map id="others::Cache::LFUCache::put" name="others::Cache::LFUCache::put">
<area shape="rect" id="Node000001" title="upsert a key&#45;value pair" alt="" coords="5,70,206,96"/>
<area shape="rect" id="Node000002" href="$df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a16a25c102554c5653721a5112ef676c9" title="increase the frequency of node and push it in the respective list." alt="" coords="268,5,442,46"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="164,67,253,46,254,52,165,72"/>
<area shape="rect" id="Node000003" href="$df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" title="push the node at first position in the linked list of given frequency" alt="" coords="505,35,679,75"/>
<area shape="poly" id="edge4_Node000001_Node000003" title=" " alt="" coords="206,75,489,58,489,64,206,80"/>
<area shape="rect" id="Node000004" href="$df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#ab3561ab204754295199f9566924f7e69" title="pop the last node in the least frequently used linked list" alt="" coords="254,121,457,146"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="173,94,274,115,273,120,172,99"/>
<area shape="poly" id="edge2_Node000002_Node000003" title=" " alt="" coords="443,34,490,40,489,45,442,39"/>
</map>

View File

@@ -0,0 +1 @@
2f5e8422a3e70831f5f71798302110cc

View File

@@ -0,0 +1,169 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.1 (20240910.0053)
-->
<!-- Title: others::Cache::LFUCache::put Pages: 1 -->
<!--zoomable 114 -->
<svg id="main" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" onload="init(evt)">
<style type="text/css"><![CDATA[
.node, .edge {opacity: 0.7;}
.node.selected, .edge.selected {opacity: 1;}
.edge:hover path { stroke: red; }
.edge:hover polygon { stroke: red; fill: red; }
]]></style>
<defs>
<circle id="rim" cx="0" cy="0" r="7"/>
<circle id="rim2" cx="0" cy="0" r="3.5"/>
<g id="zoomPlus">
<use xlink:href="#rim" fill="#404040"><set attributeName="fill" to="#808080" begin="zoomplus.mouseover" end="zoomplus.mouseout"/></use>
<path d="M-4,0h8M0,-4v8" fill="none" stroke="white" stroke-width="1.5" pointer-events="none"/>
</g>
<g id="zoomMin">
<use xlink:href="#rim" fill="#404040"><set attributeName="fill" to="#808080" begin="zoomminus.mouseover" end="zoomminus.mouseout"/></use>
<path d="M-4,0h8" fill="none" stroke="white" stroke-width="1.5" pointer-events="none"/>
</g>
<g id="arrowUp" transform="translate(30 24)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowRight" transform="rotate(90) translate(36 -43)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowDown" transform="rotate(180) translate(-30 -48)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="arrowLeft" transform="rotate(270) translate(-36 17)">
<use xlink:href="#rim"/>
<path pointer-events="none" fill="none" stroke="white" stroke-width="1.5" d="M0,-3.0v7 M-2.5,-0.5L0,-3.0L2.5,-0.5"/>
</g>
<g id="resetDef">
<use xlink:href="#rim2" fill="#404040"><set attributeName="fill" to="#808080" begin="reset.mouseover" end="reset.mouseout"/></use>
</g>
</defs>
<script type="application/ecmascript">
var viewWidth = 514;
var viewHeight = 114;
var sectionId = 'dynsection-3';
</script>
<script type="application/ecmascript" xlink:href="../../svg.min.js"/>
<svg id="graph" class="graph">
<g id="viewport">
<title>others::Cache::LFUCache::put</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="upsert a key&#45;value pair">
<polygon fill="#999999" stroke="#666666" points="150.25,-57.25 0,-57.25 0,-38 150.25,-38 150.25,-57.25"/>
<text text-anchor="middle" x="75.12" y="-43.75" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache::put</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a16a25c102554c5653721a5112ef676c9" target="_top" xlink:title="increase the frequency of node and push it in the respective list.">
<polygon fill="white" stroke="#666666" points="327.88,-105.88 197.12,-105.88 197.12,-75.38 327.88,-75.38 327.88,-105.88"/>
<text text-anchor="start" x="205.12" y="-92.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="262.5" y="-81.12" font-family="Helvetica,sans-Serif" font-size="10.00">::increase_frequency</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M119.59,-57.71C139.36,-62.29 163.34,-67.86 185.92,-73.09"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="184.86,-76.44 195.39,-75.29 186.44,-69.62 184.86,-76.44"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" target="_top" xlink:title="push the node at first position in the linked list of given frequency">
<polygon fill="white" stroke="#666666" points="505.5,-83.88 374.75,-83.88 374.75,-53.38 505.5,-53.38 505.5,-83.88"/>
<text text-anchor="start" x="382.75" y="-70.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="440.12" y="-59.12" font-family="Helvetica,sans-Serif" font-size="10.00">::push</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge4_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge4_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M150.46,-51.93C212.46,-55.51 300.45,-60.6 362.95,-64.22"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="362.62,-67.7 372.8,-64.79 363.02,-60.72 362.62,-67.7"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#ab3561ab204754295199f9566924f7e69" target="_top" xlink:title="pop the last node in the least frequently used linked list">
<polygon fill="white" stroke="#666666" points="338.75,-19.25 186.25,-19.25 186.25,0 338.75,0 338.75,-19.25"/>
<text text-anchor="middle" x="262.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache::pop</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M125.32,-37.54C148.66,-32.76 176.77,-26.99 201.37,-21.95"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="201.83,-25.43 210.92,-19.99 200.42,-18.57 201.83,-25.43"/>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2_Node000002_Node000003" class="edge">
<title>Node2&#45;&gt;Node3</title>
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M327.9,-82.56C339.4,-81.12 351.48,-79.6 363.26,-78.13"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="363.45,-81.63 372.94,-76.92 362.58,-74.69 363.45,-81.63"/>
</a>
</g>
</g>
</g>
</svg>
<g id="navigator" transform="translate(0 0)" fill="#404254">
<rect fill="#f2f5e9" fill-opacity="0.5" stroke="#606060" stroke-width=".5" x="0" y="0" width="60" height="60"/>
<use id="zoomplus" xlink:href="#zoomPlus" x="17" y="9" onmousedown="handleZoom(evt,'in')"/>
<use id="zoomminus" xlink:href="#zoomMin" x="42" y="9" onmousedown="handleZoom(evt,'out')"/>
<use id="reset" xlink:href="#resetDef" x="30" y="36" onmousedown="handleReset()"/>
<use id="arrowup" xlink:href="#arrowUp" x="0" y="0" onmousedown="handlePan(0,-1)"/>
<use id="arrowright" xlink:href="#arrowRight" x="0" y="0" onmousedown="handlePan(1,0)"/>
<use id="arrowdown" xlink:href="#arrowDown" x="0" y="0" onmousedown="handlePan(0,1)"/>
<use id="arrowleft" xlink:href="#arrowLeft" x="0" y="0" onmousedown="handlePan(-1,0)"/>
</g>
<svg viewBox="0 0 15 15" width="100%" height="30px" preserveAspectRatio="xMaxYMin meet">
<g id="arrow_out" transform="scale(0.3 0.3)">
<a xlink:href="classothers_1_1_cache_1_1_l_f_u_cache_af6f8e5a66a45436b490dfe015ff8866e_cgraph_org.svg" target="_base">
<rect id="button" ry="5" rx="5" y="6" x="6" height="38" width="38"
fill="#f2f5e9" fill-opacity="0.5" stroke="#606060" stroke-width="1.0"/>
<path id="arrow"
d="M 11.500037,31.436501 C 11.940474,20.09759 22.043105,11.32322 32.158766,21.979434 L 37.068811,17.246167 C 37.068811,17.246167 37.088388,32 37.088388,32 L 22.160133,31.978069 C 22.160133,31.978069 26.997745,27.140456 26.997745,27.140456 C 18.528582,18.264221 13.291696,25.230495 11.500037,31.436501 z"
style="fill:#404040;"/>
</a>
</g>
</svg>
<style type='text/css'>
<![CDATA[
[data-mouse-over-selected='false'] { opacity: 0.7; }
[data-mouse-over-selected='true'] { opacity: 1.0; }
]]>
</style>
<script type="application/ecmascript"><![CDATA[
document.addEventListener('DOMContentLoaded', (event) => {
highlightEdges();
highlightAdjacentNodes();
});
]]></script>
</svg>

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.1 (20240910.0053)
-->
<!-- Title: others::Cache::LFUCache::put Pages: 1 -->
<svg width="514pt" height="114pt"
viewBox="0.00 0.00 513.50 113.88" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 109.88)">
<title>others::Cache::LFUCache::put</title>
<!-- Node1 -->
<g id="Node000001" class="node">
<title>Node1</title>
<g id="a_Node000001"><a xlink:title="upsert a key&#45;value pair">
<polygon fill="#999999" stroke="#666666" points="150.25,-57.25 0,-57.25 0,-38 150.25,-38 150.25,-57.25"/>
<text text-anchor="middle" x="75.12" y="-43.75" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache::put</text>
</a>
</g>
</g>
<!-- Node2 -->
<g id="Node000002" class="node">
<title>Node2</title>
<g id="a_Node000002"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#a16a25c102554c5653721a5112ef676c9" target="_top" xlink:title="increase the frequency of node and push it in the respective list.">
<polygon fill="white" stroke="#666666" points="327.88,-105.88 197.12,-105.88 197.12,-75.38 327.88,-75.38 327.88,-105.88"/>
<text text-anchor="start" x="205.12" y="-92.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="262.5" y="-81.12" font-family="Helvetica,sans-Serif" font-size="10.00">::increase_frequency</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node2 -->
<g id="edge1_Node000001_Node000002" class="edge">
<title>Node1&#45;&gt;Node2</title>
<g id="a_edge1_Node000001_Node000002"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M119.59,-57.71C139.36,-62.29 163.34,-67.86 185.92,-73.09"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="184.86,-76.44 195.39,-75.29 186.44,-69.62 184.86,-76.44"/>
</a>
</g>
</g>
<!-- Node3 -->
<g id="Node000003" class="node">
<title>Node3</title>
<g id="a_Node000003"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#adad4ab43141fb8ba43facd3a71e07047" target="_top" xlink:title="push the node at first position in the linked list of given frequency">
<polygon fill="white" stroke="#666666" points="505.5,-83.88 374.75,-83.88 374.75,-53.38 505.5,-53.38 505.5,-83.88"/>
<text text-anchor="start" x="382.75" y="-70.38" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache</text>
<text text-anchor="middle" x="440.12" y="-59.12" font-family="Helvetica,sans-Serif" font-size="10.00">::push</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node3 -->
<g id="edge4_Node000001_Node000003" class="edge">
<title>Node1&#45;&gt;Node3</title>
<g id="a_edge4_Node000001_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M150.46,-51.93C212.46,-55.51 300.45,-60.6 362.95,-64.22"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="362.62,-67.7 372.8,-64.79 363.02,-60.72 362.62,-67.7"/>
</a>
</g>
</g>
<!-- Node4 -->
<g id="Node000004" class="node">
<title>Node4</title>
<g id="a_Node000004"><a xlink:href="../../df/d8f/classothers_1_1_cache_1_1_l_f_u_cache.html#ab3561ab204754295199f9566924f7e69" target="_top" xlink:title="pop the last node in the least frequently used linked list">
<polygon fill="white" stroke="#666666" points="338.75,-19.25 186.25,-19.25 186.25,0 338.75,0 338.75,-19.25"/>
<text text-anchor="middle" x="262.5" y="-5.75" font-family="Helvetica,sans-Serif" font-size="10.00">others::Cache::LFUCache::pop</text>
</a>
</g>
</g>
<!-- Node1&#45;&gt;Node4 -->
<g id="edge3_Node000001_Node000004" class="edge">
<title>Node1&#45;&gt;Node4</title>
<g id="a_edge3_Node000001_Node000004"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M125.32,-37.54C148.66,-32.76 176.77,-26.99 201.37,-21.95"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="201.83,-25.43 210.92,-19.99 200.42,-18.57 201.83,-25.43"/>
</a>
</g>
</g>
<!-- Node2&#45;&gt;Node3 -->
<g id="edge2_Node000002_Node000003" class="edge">
<title>Node2&#45;&gt;Node3</title>
<g id="a_edge2_Node000002_Node000003"><a xlink:title=" ">
<path fill="none" stroke="#63b8ff" d="M327.9,-82.56C339.4,-81.12 351.48,-79.6 363.26,-78.13"/>
<polygon fill="#63b8ff" stroke="#63b8ff" points="363.45,-81.63 372.94,-76.92 362.58,-74.69 363.45,-81.63"/>
</a>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.3 KiB