mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-25 22:32:24 +08:00
Documentation for 8b1eab204b
This commit is contained in:
@@ -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/tree_234.cpp File Reference</title>
|
||||
<title>TheAlgorithms/C++: data_structures/tree_234.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"> 1.0.0</span>
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 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>
|
||||
@@ -126,7 +143,9 @@ Include dependency graph for tree_234.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d4/dc8/tree__234_8cpp__incl.svg" width="584" 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="../../db/dbc/tree__234_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  </td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d40/classdata__structures_1_1tree__234_1_1_node.html">data_structures::tree_234::Node</a></td></tr>
|
||||
@@ -160,6 +179,8 @@ Functions</h2></td></tr>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>A demo 2-3-4 tree implementation. </p>
|
||||
<p>2–3–4 tree is a self-balancing data structure that is an isometry of red–black trees. Though we seldom use them in practice, we study them to understand the theory behind Red-Black tree. Please read following links for more infomation. <a href="https://en.wikipedia.org/wiki/2%E2%80%933%E2%80%934_tree" target="_blank">2–3–4 tree</a> <a href="https://www.educative.io/page/5689413791121408/80001" target="_blank">2-3-4 Trees: A Visual Introduction</a> We Only implement some basic and complicated operations in this demo. Other operations should be easy to be added. </p><dl class="section author"><dt>Author</dt><dd><a href="https://github.com/fedom" target="_blank">liuhuan</a> </dd></dl>
|
||||
|
||||
<p class="definition">Definition in file <a class="el" href="../../db/dbc/tree__234_8cpp_source.html">tree_234.cpp</a>.</p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a0ddf1224851353fc92bfbff6f499fa97" name="a0ddf1224851353fc92bfbff6f499fa97"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a0ddf1224851353fc92bfbff6f499fa97">◆ </a></span>main()</h2>
|
||||
@@ -189,24 +210,20 @@ Functions</h2></td></tr>
|
||||
</dd>
|
||||
</dl>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../db/dbc/tree__234_8cpp_source.html#l01298">1298</a> of file <a class="el" href="../../db/dbc/tree__234_8cpp_source.html">tree_234.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 1298</span> {</div>
|
||||
<div class="line"><span class="lineno"> 1299</span> <span class="keywordflow">if</span> (argc < 2) {</div>
|
||||
<div class="line"><span class="lineno"> 1300</span> <a class="code hl_function" href="#ae7880ce913f3058a35ff106d5be9e243">test1</a>(); <span class="comment">// execute 1st test</span></div>
|
||||
<div class="line"><span class="lineno"> 1301</span> } <span class="keywordflow">else</span> {</div>
|
||||
<div class="line"><span class="lineno"> 1302</span> <a class="code hl_function" href="../../d3/dae/dsu__path__compression_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a>(<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/stol.html">std::stoi</a>(argv[1])); <span class="comment">// execute 2nd test</span></div>
|
||||
<div class="line"><span class="lineno"> 1302</span> <a class="code hl_function" href="../../d3/dae/dsu__path__compression_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a>(std::stoi(argv[1])); <span class="comment">// execute 2nd test</span></div>
|
||||
<div class="line"><span class="lineno"> 1303</span> }</div>
|
||||
<div class="line"><span class="lineno"> 1304</span> </div>
|
||||
<div class="line"><span class="lineno"> 1305</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><span class="lineno"> 1306</span>}</div>
|
||||
<div class="ttc" id="adsu__path__compression_8cpp_html_a45d94ead4cf4e1ff9f87c38bc99f59ae"><div class="ttname"><a href="../../d3/dae/dsu__path__compression_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a></div><div class="ttdeci">static void test2()</div><div class="ttdoc">Self-implementations, 2nd test.</div><div class="ttdef"><b>Definition</b> dsu_path_compression.cpp:187</div></div>
|
||||
<div class="ttc" id="astol_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/stol.html">std::stoi</a></div><div class="ttdeci">T stoi(T... args)</div></div>
|
||||
<div class="ttc" id="atree__234_8cpp_html_ae7880ce913f3058a35ff106d5be9e243"><div class="ttname"><a href="#ae7880ce913f3058a35ff106d5be9e243">test1</a></div><div class="ttdeci">static void test1()</div><div class="ttdoc">simple test to insert a given array and delete some item, and print the tree</div><div class="ttdef"><b>Definition</b> tree_234.cpp:1263</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="../../db/dbc/tree__234_8cpp_a0ddf1224851353fc92bfbff6f499fa97_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="adsu__path__compression_8cpp_html_a45d94ead4cf4e1ff9f87c38bc99f59ae"><div class="ttname"><a href="../../d3/dae/dsu__path__compression_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a></div><div class="ttdeci">static void test2()</div><div class="ttdoc">Self-implementations, 2nd test.</div><div class="ttdef"><b>Definition</b> <a href="../../d3/dae/dsu__path__compression_8cpp_source.html#l00187">dsu_path_compression.cpp:187</a></div></div>
|
||||
<div class="ttc" id="atree__234_8cpp_html_ae7880ce913f3058a35ff106d5be9e243"><div class="ttname"><a href="#ae7880ce913f3058a35ff106d5be9e243">test1</a></div><div class="ttdeci">static void test1()</div><div class="ttdoc">simple test to insert a given array and delete some item, and print the tree</div><div class="ttdef"><b>Definition</b> <a href="../../db/dbc/tree__234_8cpp_source.html#l01263">tree_234.cpp:1263</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae7880ce913f3058a35ff106d5be9e243" name="ae7880ce913f3058a35ff106d5be9e243"></a>
|
||||
@@ -233,8 +250,10 @@ Here is the call graph for this function:</div>
|
||||
</div><div class="memdoc">
|
||||
|
||||
<p>simple test to insert a given array and delete some item, and print the tree </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../db/dbc/tree__234_8cpp_source.html#l01263">1263</a> of file <a class="el" href="../../db/dbc/tree__234_8cpp_source.html">tree_234.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 1263</span> {</div>
|
||||
<div class="line"><span class="lineno"> 1264</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array.html">std::array<int16_t, 13></a> arr = {3, 1, 5, 4, 2, 9, 10, 8, 7, 6, 16, 13, 14};</div>
|
||||
<div class="line"><span class="lineno"> 1264</span> std::array<int16_t, 13> arr = {3, 1, 5, 4, 2, 9, 10, 8, 7, 6, 16, 13, 14};</div>
|
||||
<div class="line"><span class="lineno"> 1265</span> <a class="code hl_class" href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html">data_structures::tree_234::Tree234</a> tree;</div>
|
||||
<div class="line"><span class="lineno"> 1266</span> </div>
|
||||
<div class="line"><span class="lineno"> 1267</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : arr) {</div>
|
||||
@@ -245,17 +264,11 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 1272</span> tree.<a class="code hl_function" href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a5da1be3f5b5d967ebb36a201f3ebad11">Remove</a>(5);</div>
|
||||
<div class="line"><span class="lineno"> 1273</span> tree.<a class="code hl_function" href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a2e9a9db7792cf5383f4c4cc418255165">Print</a>();</div>
|
||||
<div class="line"><span class="lineno"> 1274</span>}</div>
|
||||
<div class="ttc" id="aarray_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/array.html">std::array</a></div></div>
|
||||
<div class="ttc" id="aclassdata__structures_1_1tree__234_1_1_tree234_html"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html">data_structures::tree_234::Tree234</a></div><div class="ttdoc">2-3-4 tree class</div><div class="ttdef"><b>Definition</b> tree_234.cpp:323</div></div>
|
||||
<div class="ttc" id="aclassdata__structures_1_1tree__234_1_1_tree234_html_a2e9a9db7792cf5383f4c4cc418255165"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a2e9a9db7792cf5383f4c4cc418255165">data_structures::tree_234::Tree234::Print</a></div><div class="ttdeci">void Print(const char *file_name=nullptr)</div><div class="ttdoc">Print tree into a dot file.</div><div class="ttdef"><b>Definition</b> tree_234.cpp:1131</div></div>
|
||||
<div class="ttc" id="aclassdata__structures_1_1tree__234_1_1_tree234_html_a5da1be3f5b5d967ebb36a201f3ebad11"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a5da1be3f5b5d967ebb36a201f3ebad11">data_structures::tree_234::Tree234::Remove</a></div><div class="ttdeci">bool Remove(int64_t item)</div><div class="ttdoc">Remove item from tree.</div><div class="ttdef"><b>Definition</b> tree_234.cpp:929</div></div>
|
||||
<div class="ttc" id="aclassdata__structures_1_1tree__234_1_1_tree234_html_a6749ebb40710c9752a2771eda03c6b3e"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a6749ebb40710c9752a2771eda03c6b3e">data_structures::tree_234::Tree234::Insert</a></div><div class="ttdeci">void Insert(int64_t item)</div><div class="ttdoc">Insert item to tree.</div><div class="ttdef"><b>Definition</b> tree_234.cpp:655</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="../../db/dbc/tree__234_8cpp_ae7880ce913f3058a35ff106d5be9e243_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="aclassdata__structures_1_1tree__234_1_1_tree234_html"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html">data_structures::tree_234::Tree234</a></div><div class="ttdoc">2-3-4 tree class</div><div class="ttdef"><b>Definition</b> <a href="../../db/dbc/tree__234_8cpp_source.html#l00323">tree_234.cpp:323</a></div></div>
|
||||
<div class="ttc" id="aclassdata__structures_1_1tree__234_1_1_tree234_html_a2e9a9db7792cf5383f4c4cc418255165"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a2e9a9db7792cf5383f4c4cc418255165">data_structures::tree_234::Tree234::Print</a></div><div class="ttdeci">void Print(const char *file_name=nullptr)</div><div class="ttdoc">Print tree into a dot file.</div><div class="ttdef"><b>Definition</b> <a href="../../db/dbc/tree__234_8cpp_source.html#l01131">tree_234.cpp:1131</a></div></div>
|
||||
<div class="ttc" id="aclassdata__structures_1_1tree__234_1_1_tree234_html_a5da1be3f5b5d967ebb36a201f3ebad11"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a5da1be3f5b5d967ebb36a201f3ebad11">data_structures::tree_234::Tree234::Remove</a></div><div class="ttdeci">bool Remove(int64_t item)</div><div class="ttdoc">Remove item from tree.</div><div class="ttdef"><b>Definition</b> <a href="../../db/dbc/tree__234_8cpp_source.html#l00929">tree_234.cpp:929</a></div></div>
|
||||
<div class="ttc" id="aclassdata__structures_1_1tree__234_1_1_tree234_html_a6749ebb40710c9752a2771eda03c6b3e"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a6749ebb40710c9752a2771eda03c6b3e">data_structures::tree_234::Tree234::Insert</a></div><div class="ttdeci">void Insert(int64_t item)</div><div class="ttdoc">Insert item to tree.</div><div class="ttdef"><b>Definition</b> <a href="../../db/dbc/tree__234_8cpp_source.html#l00655">tree_234.cpp:655</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="af1ac73779b0fcfbbdce3976c0ca57342" name="af1ac73779b0fcfbbdce3976c0ca57342"></a>
|
||||
@@ -288,6 +301,8 @@ Here is the call graph for this function:</div>
|
||||
</table>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../db/dbc/tree__234_8cpp_source.html#l01281">1281</a> of file <a class="el" href="../../db/dbc/tree__234_8cpp_source.html">tree_234.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 1281</span> {</div>
|
||||
<div class="line"><span class="lineno"> 1282</span> <a class="code hl_class" href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html">data_structures::tree_234::Tree234</a> tree;</div>
|
||||
<div class="line"><span class="lineno"> 1283</span> </div>
|
||||
@@ -296,16 +311,10 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 1286</span> }</div>
|
||||
<div class="line"><span class="lineno"> 1287</span> </div>
|
||||
<div class="line"><span class="lineno"> 1288</span> tree.<a class="code hl_function" href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a84ab7b4fe7442b5e2eeed8c050bb86bd">Traverse</a>();</div>
|
||||
<div class="line"><span class="lineno"> 1289</span> tree.<a class="code hl_function" href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a2e9a9db7792cf5383f4c4cc418255165">Print</a>((<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/basic_string/to_string.html">std::to_string</a>(n) + <span class="stringliteral">".dot"</span>).c_str());</div>
|
||||
<div class="line"><span class="lineno"> 1289</span> tree.<a class="code hl_function" href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a2e9a9db7792cf5383f4c4cc418255165">Print</a>((std::to_string(n) + <span class="stringliteral">".dot"</span>).c_str());</div>
|
||||
<div class="line"><span class="lineno"> 1290</span>}</div>
|
||||
<div class="ttc" id="aclassdata__structures_1_1tree__234_1_1_tree234_html_a84ab7b4fe7442b5e2eeed8c050bb86bd"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a84ab7b4fe7442b5e2eeed8c050bb86bd">data_structures::tree_234::Tree234::Traverse</a></div><div class="ttdeci">void Traverse()</div><div class="ttdoc">In-order traverse.</div><div class="ttdef"><b>Definition</b> tree_234.cpp:562</div></div>
|
||||
<div class="ttc" id="ato_string_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/basic_string/to_string.html">std::to_string</a></div><div class="ttdeci">T to_string(T... args)</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="../../db/dbc/tree__234_8cpp_af1ac73779b0fcfbbdce3976c0ca57342_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="aclassdata__structures_1_1tree__234_1_1_tree234_html_a84ab7b4fe7442b5e2eeed8c050bb86bd"><div class="ttname"><a href="../../d3/d95/classdata__structures_1_1tree__234_1_1_tree234.html#a84ab7b4fe7442b5e2eeed8c050bb86bd">data_structures::tree_234::Tree234::Traverse</a></div><div class="ttdeci">void Traverse()</div><div class="ttdoc">In-order traverse.</div><div class="ttdef"><b>Definition</b> <a href="../../db/dbc/tree__234_8cpp_source.html#l00562">tree_234.cpp:562</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
|
||||
Reference in New Issue
Block a user