Documentation for 8b1eab204b

This commit is contained in:
realstealthninja
2024-11-04 12:43:05 +00:00
parent 4fb6e622e9
commit a7bccf7d01
6732 changed files with 153919 additions and 365711 deletions

View File

@@ -1,3 +1,4 @@
<!-- HTML header for doxygen 1.12.0-->
<!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>
@@ -5,10 +6,15 @@
<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++: data_structures/trie_using_hashmap.cpp File Reference</title>
<title>TheAlgorithms/C++: data_structures/trie_using_hashmap.cpp File Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
<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="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
<script type="text/javascript">
DoxygenAwesomeDarkModeToggle.init()
</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>
@@ -18,14 +24,24 @@
<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 type="text/javascript">
window.MathJax = {
options: {
ignoreHtmlClass: 'tex2jax_ignore',
processHtmlClass: 'tex2jax_process'
},
loader: {
load: ['[tex]/ams']
},
tex: {
macros: {},
packages: ['base','configmacros','ams']
}
};
</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>
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
<td id="projectalign">
<div id="projectname">Algorithms_in_C++<span id="projectnumber">&#160;1.0.0</span>
<div id="projectname">TheAlgorithms/C++<span id="projectnumber">&#160;1.0.0</span>
</div>
<div id="projectbrief">Set of algorithms implemented in C++.</div>
<div id="projectbrief">All the algorithms implemented in C++</div>
</td>
</tr>
</tbody>
@@ -125,7 +142,9 @@ Include dependency graph for trie_using_hashmap.cpp:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d3/dfd/trie__using__hashmap_8cpp__incl.svg" width="556" height="126"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
</div><table class="memberdecls">
</div>
<p><a href="../../d5/d8a/trie__using__hashmap_8cpp_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">class &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html">data_structures::trie_using_hashmap::Trie</a></td></tr>
@@ -157,6 +176,8 @@ Functions</h2></td></tr>
<div class="textblock"><p>Implementation of <a href="https://en.wikipedia.org/wiki/Trie" target="_blank">Trie</a> data structure using HashMap for different characters and method for predicting words based on prefix. </p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/bharath000" target="_blank">Venkata Bharath</a></dd></dl>
<p>The <a class="el" href="../../dd/d2f/class_trie.html">Trie</a> data structure is implemented using unordered map to use memory optimally, predict_words method is developed to recommend words based on a given prefix along with other methods insert, delete, search, startwith in trie. </p><dl class="section see"><dt>See also</dt><dd><a class="el" href="../../dc/d93/trie__modern_8cpp.html" title="A basic implementation of trie class to store only lower-case strings.">trie_modern.cpp</a> for difference </dd></dl>
<p class="definition">Definition in file <a class="el" href="../../d5/d8a/trie__using__hashmap_8cpp_source.html">trie_using_hashmap.cpp</a>.</p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&#160;</a></span>main()</h2>
@@ -175,17 +196,14 @@ Functions</h2></td></tr>
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00342">342</a> of file <a class="el" href="../../d5/d8a/trie__using__hashmap_8cpp_source.html">trie_using_hashmap.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 342</span> {</div>
<div class="line"><span class="lineno"> 343</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementaions</span></div>
<div class="line"><span class="lineno"> 344</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 345</span>}</div>
<div class="ttc" id="atrie__using__hashmap_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> trie_using_hashmap.cpp:221</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="../../d5/d8a/trie__using__hashmap_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="100%" height="600"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div></div>
</div>
<div class="ttc" id="atrie__using__hashmap_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00221">trie_using_hashmap.cpp:221</a></div></div>
</div><!-- fragment -->
</div>
</div>
<a id="aa8dca7b867074164d5f45b0f3851269d" name="aa8dca7b867074164d5f45b0f3851269d"></a>
@@ -213,6 +231,8 @@ Here is the call graph for this function:</div>
<p>Self-test implementations. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<p class="definition">Definition at line <a class="el" href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00221">221</a> of file <a class="el" href="../../d5/d8a/trie__using__hashmap_8cpp_source.html">trie_using_hashmap.cpp</a>.</p>
<div class="fragment"><div class="line"><span class="lineno"> 221</span> {</div>
<div class="line"><span class="lineno"> 222</span> <a class="code hl_class" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html">data_structures::trie_using_hashmap::Trie</a> obj;</div>
<div class="line"><span class="lineno"> 223</span> <span class="comment">// Inserting data into trie using the insert</span></div>
@@ -231,10 +251,10 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 236</span> obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#abcae0a4456e7f583ce716e3ef466dfd2">insert</a>(<span class="stringliteral">&quot;Bounce&quot;</span>);</div>
<div class="line"><span class="lineno"> 237</span> </div>
<div class="line"><span class="lineno"> 238</span> assert(!obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">search</a>(<span class="stringliteral">&quot;appy&quot;</span>));</div>
<div class="line"><span class="lineno"> 239</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;appy is not a word in trie&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 239</span> std::cout &lt;&lt; <span class="stringliteral">&quot;appy is not a word in trie&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 240</span> </div>
<div class="line"><span class="lineno"> 241</span> assert(!obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">search</a>(<span class="stringliteral">&quot;car&quot;</span>));</div>
<div class="line"><span class="lineno"> 242</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;car is not a word in trie&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 242</span> std::cout &lt;&lt; <span class="stringliteral">&quot;car is not a word in trie&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 243</span> assert(obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">search</a>(<span class="stringliteral">&quot;app&quot;</span>));</div>
<div class="line"><span class="lineno"> 244</span> assert(obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">search</a>(<span class="stringliteral">&quot;apple&quot;</span>));</div>
<div class="line"><span class="lineno"> 245</span> assert(obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">search</a>(<span class="stringliteral">&quot;apples&quot;</span>));</div>
@@ -248,7 +268,7 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 253</span> assert(obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">search</a>(<span class="stringliteral">&quot;Bounce&quot;</span>));</div>
<div class="line"><span class="lineno"> 254</span> assert(obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">search</a>(<span class="stringliteral">&quot;Apple&quot;</span>));</div>
<div class="line"><span class="lineno"> 255</span> </div>
<div class="line"><span class="lineno"> 256</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;All the Inserted words are present in the trie&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 256</span> std::cout &lt;&lt; <span class="stringliteral">&quot;All the Inserted words are present in the trie&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 257</span> </div>
<div class="line"><span class="lineno"> 258</span> <span class="comment">// test for startwith prefix method</span></div>
<div class="line"><span class="lineno"> 259</span> assert(!obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#af3aee573fbabd2c1510c0f74f842dd17">startwith</a>(<span class="stringliteral">&quot;approachs&quot;</span>));</div>
@@ -269,54 +289,54 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 274</span> </div>
<div class="line"><span class="lineno"> 275</span> assert(!obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#af3aee573fbabd2c1510c0f74f842dd17">startwith</a>(<span class="stringliteral">&quot;C&quot;</span>));</div>
<div class="line"><span class="lineno"> 276</span> </div>
<div class="line"><span class="lineno"> 277</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;All the tests passed for startwith method&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 277</span> std::cout &lt;&lt; <span class="stringliteral">&quot;All the tests passed for startwith method&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 278</span> </div>
<div class="line"><span class="lineno"> 279</span> <span class="comment">// test for predict_words/recommendation of words based on a given prefix</span></div>
<div class="line"><span class="lineno"> 280</span> </div>
<div class="line"><span class="lineno"> 281</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;std::string&gt;</a> pred_words = obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;a&quot;</span>);</div>
<div class="line"><span class="lineno"> 281</span> std::vector&lt;std::string&gt; pred_words = obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;a&quot;</span>);</div>
<div class="line"><span class="lineno"> 282</span> </div>
<div class="line"><span class="lineno"> 283</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&amp; str : obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;a&quot;</span>)) {</div>
<div class="line"><span class="lineno"> 284</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; str &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 283</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> std::string&amp; str : obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;a&quot;</span>)) {</div>
<div class="line"><span class="lineno"> 284</span> std::cout &lt;&lt; str &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 285</span> }</div>
<div class="line"><span class="lineno"> 286</span> assert(pred_words.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>() == 8);</div>
<div class="line"><span class="lineno"> 287</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Returned all words that start with prefix a &quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 286</span> assert(pred_words.size() == 8);</div>
<div class="line"><span class="lineno"> 287</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Returned all words that start with prefix a &quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 288</span> pred_words = obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;app&quot;</span>);</div>
<div class="line"><span class="lineno"> 289</span> </div>
<div class="line"><span class="lineno"> 290</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&amp; str : pred_words) {</div>
<div class="line"><span class="lineno"> 291</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; str &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 290</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> std::string&amp; str : pred_words) {</div>
<div class="line"><span class="lineno"> 291</span> std::cout &lt;&lt; str &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 292</span> }</div>
<div class="line"><span class="lineno"> 293</span> </div>
<div class="line"><span class="lineno"> 294</span> assert(pred_words.size() == 5);</div>
<div class="line"><span class="lineno"> 295</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Returned all words that start with prefix app &quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 295</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Returned all words that start with prefix app &quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 296</span> pred_words = obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;A&quot;</span>);</div>
<div class="line"><span class="lineno"> 297</span> </div>
<div class="line"><span class="lineno"> 298</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&amp; str : pred_words) {</div>
<div class="line"><span class="lineno"> 299</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; str &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 298</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> std::string&amp; str : pred_words) {</div>
<div class="line"><span class="lineno"> 299</span> std::cout &lt;&lt; str &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 300</span> }</div>
<div class="line"><span class="lineno"> 301</span> </div>
<div class="line"><span class="lineno"> 302</span> assert(pred_words.size() == 1);</div>
<div class="line"><span class="lineno"> 303</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Returned all words that start with prefix A &quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 303</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Returned all words that start with prefix A &quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 304</span> pred_words = obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;bu&quot;</span>);</div>
<div class="line"><span class="lineno"> 305</span> </div>
<div class="line"><span class="lineno"> 306</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&amp; str : pred_words) {</div>
<div class="line"><span class="lineno"> 307</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; str &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 306</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> std::string&amp; str : pred_words) {</div>
<div class="line"><span class="lineno"> 307</span> std::cout &lt;&lt; str &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 308</span> }</div>
<div class="line"><span class="lineno"> 309</span> </div>
<div class="line"><span class="lineno"> 310</span> assert(pred_words.size() == 2);</div>
<div class="line"><span class="lineno"> 311</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Returned all words that start with prefix bu &quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 311</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Returned all words that start with prefix bu &quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 312</span> </div>
<div class="line"><span class="lineno"> 313</span> <span class="comment">// tests for delete method</span></div>
<div class="line"><span class="lineno"> 314</span> </div>
<div class="line"><span class="lineno"> 315</span> obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ac0bf3d6791cba144b3f539835d835e75">delete_word</a>(<span class="stringliteral">&quot;app&quot;</span>);</div>
<div class="line"><span class="lineno"> 316</span> assert(!obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">search</a>(<span class="stringliteral">&quot;app&quot;</span>));</div>
<div class="line"><span class="lineno"> 317</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;word app is deleted sucessful&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 317</span> std::cout &lt;&lt; <span class="stringliteral">&quot;word app is deleted sucessful&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 318</span> </div>
<div class="line"><span class="lineno"> 319</span> pred_words = obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;app&quot;</span>);</div>
<div class="line"><span class="lineno"> 320</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a>&amp; str : pred_words) {</div>
<div class="line"><span class="lineno"> 321</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; str &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 320</span> <span class="keywordflow">for</span> (<span class="keyword">const</span> std::string&amp; str : pred_words) {</div>
<div class="line"><span class="lineno"> 321</span> std::cout &lt;&lt; str &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 322</span> }</div>
<div class="line"><span class="lineno"> 323</span> assert(pred_words.size() == 4);</div>
<div class="line"><span class="lineno"> 324</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;app is deleted sucessful&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 324</span> std::cout &lt;&lt; <span class="stringliteral">&quot;app is deleted sucessful&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 325</span> </div>
<div class="line"><span class="lineno"> 326</span> <span class="comment">// test case for Chinese language</span></div>
<div class="line"><span class="lineno"> 327</span> </div>
@@ -325,27 +345,17 @@ Here is the call graph for this function:</div>
<div class="line"><span class="lineno"> 330</span> pred_words = obj.<a class="code hl_function" href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">predict_words</a>(<span class="stringliteral">&quot;h&quot;</span>);</div>
<div class="line"><span class="lineno"> 331</span> </div>
<div class="line"><span class="lineno"> 332</span> assert(pred_words.size() == 0);</div>
<div class="line"><span class="lineno"> 333</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;No word starts with prefix h in trie&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 333</span> std::cout &lt;&lt; <span class="stringliteral">&quot;No word starts with prefix h in trie&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 334</span> </div>
<div class="line"><span class="lineno"> 335</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;All tests passed&quot;</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><span class="lineno"> 335</span> std::cout &lt;&lt; <span class="stringliteral">&quot;All tests passed&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 336</span>}</div>
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
<div class="ttc" id="abasic_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string.html">std::string</a></div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html">data_structures::trie_using_hashmap::Trie</a></div><div class="ttdoc">Trie class, implementation of trie using hashmap in each trie node for all the characters of char16_t...</div><div class="ttdef"><b>Definition</b> trie_using_hashmap.cpp:39</div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_abcae0a4456e7f583ce716e3ef466dfd2"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#abcae0a4456e7f583ce716e3ef466dfd2">data_structures::trie_using_hashmap::Trie::insert</a></div><div class="ttdeci">void insert(const std::string &amp;word)</div><div class="ttdoc">insert the string into the trie</div><div class="ttdef"><b>Definition</b> trie_using_hashmap.cpp:62</div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_ac0bf3d6791cba144b3f539835d835e75"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ac0bf3d6791cba144b3f539835d835e75">data_structures::trie_using_hashmap::Trie::delete_word</a></div><div class="ttdeci">void delete_word(std::string word)</div><div class="ttdoc">delete a word/string from a trie</div><div class="ttdef"><b>Definition</b> trie_using_hashmap.cpp:122</div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_ad71eb24207c28b546631802dba97310f"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">data_structures::trie_using_hashmap::Trie::search</a></div><div class="ttdeci">bool search(const std::string &amp;word)</div><div class="ttdoc">search a word/string inside the trie</div><div class="ttdef"><b>Definition</b> trie_using_hashmap.cpp:82</div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_ae15fdc7f2b5023992d87a711d78566c4"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">data_structures::trie_using_hashmap::Trie::predict_words</a></div><div class="ttdeci">std::vector&lt; std::string &gt; predict_words(const std::string &amp;prefix)</div><div class="ttdoc">predict/recommend a word that starts with a given prefix</div><div class="ttdef"><b>Definition</b> trie_using_hashmap.cpp:188</div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_af3aee573fbabd2c1510c0f74f842dd17"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#af3aee573fbabd2c1510c0f74f842dd17">data_structures::trie_using_hashmap::Trie::startwith</a></div><div class="ttdeci">bool startwith(const std::string &amp;prefix)</div><div class="ttdoc">search a word/string that starts with a given prefix</div><div class="ttdef"><b>Definition</b> trie_using_hashmap.cpp:107</div></div>
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/size.html">std::vector::size</a></div><div class="ttdeci">T size(T... args)</div></div>
<div class="ttc" id="avector_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</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="../../d5/d8a/trie__using__hashmap_8cpp_aa8dca7b867074164d5f45b0f3851269d_cgraph.svg" width="651" height="592"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html">data_structures::trie_using_hashmap::Trie</a></div><div class="ttdoc">Trie class, implementation of trie using hashmap in each trie node for all the characters of char16_t...</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00039">trie_using_hashmap.cpp:39</a></div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_abcae0a4456e7f583ce716e3ef466dfd2"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#abcae0a4456e7f583ce716e3ef466dfd2">data_structures::trie_using_hashmap::Trie::insert</a></div><div class="ttdeci">void insert(const std::string &amp;word)</div><div class="ttdoc">insert the string into the trie</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00062">trie_using_hashmap.cpp:62</a></div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_ac0bf3d6791cba144b3f539835d835e75"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ac0bf3d6791cba144b3f539835d835e75">data_structures::trie_using_hashmap::Trie::delete_word</a></div><div class="ttdeci">void delete_word(std::string word)</div><div class="ttdoc">delete a word/string from a trie</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00122">trie_using_hashmap.cpp:122</a></div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_ad71eb24207c28b546631802dba97310f"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ad71eb24207c28b546631802dba97310f">data_structures::trie_using_hashmap::Trie::search</a></div><div class="ttdeci">bool search(const std::string &amp;word)</div><div class="ttdoc">search a word/string inside the trie</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00082">trie_using_hashmap.cpp:82</a></div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_ae15fdc7f2b5023992d87a711d78566c4"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#ae15fdc7f2b5023992d87a711d78566c4">data_structures::trie_using_hashmap::Trie::predict_words</a></div><div class="ttdeci">std::vector&lt; std::string &gt; predict_words(const std::string &amp;prefix)</div><div class="ttdoc">predict/recommend a word that starts with a given prefix</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00188">trie_using_hashmap.cpp:188</a></div></div>
<div class="ttc" id="aclassdata__structures_1_1trie__using__hashmap_1_1_trie_html_af3aee573fbabd2c1510c0f74f842dd17"><div class="ttname"><a href="../../d3/d26/classdata__structures_1_1trie__using__hashmap_1_1_trie.html#af3aee573fbabd2c1510c0f74f842dd17">data_structures::trie_using_hashmap::Trie::startwith</a></div><div class="ttdeci">bool startwith(const std::string &amp;prefix)</div><div class="ttdoc">search a word/string that starts with a given prefix</div><div class="ttdef"><b>Definition</b> <a href="../../d5/d8a/trie__using__hashmap_8cpp_source.html#l00107">trie_using_hashmap.cpp:107</a></div></div>
</div><!-- fragment -->
</div>
</div>
</div><!-- contents -->