Documentation for 52db277fb6

This commit is contained in:
realstealthninja
2024-09-01 23:04:51 +00:00
parent 2a5773d8eb
commit 2ad14b2b2f

View File

@@ -145,6 +145,8 @@ Namespaces</h2></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a0eec4455ee737c32976963e3aabb9d9f" id="r_a0eec4455ee737c32976963e3aabb9d9f"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a0eec4455ee737c32976963e3aabb9d9f">others::iterative_tree_traversals::deleteAll</a> (<a class="el" href="../../d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node.html">Node</a> *root)</td></tr>
<tr class="separator:a0eec4455ee737c32976963e3aabb9d9f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a21d922dbb5905993960c6a7f0ba71ac0" id="r_a21d922dbb5905993960c6a7f0ba71ac0"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a21d922dbb5905993960c6a7f0ba71ac0">test1</a> (<a class="el" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html">others::iterative_tree_traversals::BinaryTree</a> binaryTree, <a class="el" href="../../d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node.html">others::iterative_tree_traversals::Node</a> *root)</td></tr>
<tr class="memdesc:a21d922dbb5905993960c6a7f0ba71ac0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Test the computed preorder with the actual preorder. <br /></td></tr>
<tr class="separator:a21d922dbb5905993960c6a7f0ba71ac0"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -180,6 +182,49 @@ Iterative Postorder Traversal of a tree</h3>
Iterative Inorder Traversal of a tree</h3>
<p>Create a Stack that will store the <a class="el" href="../../db/d8b/struct_node.html">Node</a> of Tree. Push the root node into the stack. Save the root into the variabe named as current. Now iterate and take the current to the extreme left of the tree by traversing only to its left. Pop the elemnt from the stack and assign it to the current. Store the data of current into the result array. Repeat the same set of steps until the Stack becomes empty or the current becomes NULL. And return the result array as the inorder traversal of a tree. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a0eec4455ee737c32976963e3aabb9d9f" name="a0eec4455ee737c32976963e3aabb9d9f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0eec4455ee737c32976963e3aabb9d9f">&#9670;&#160;</a></span>deleteAll()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void others::iterative_tree_traversals::deleteAll </td>
<td>(</td>
<td class="paramtype"><a class="el" href="../../d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node.html">Node</a> *</td> <td class="paramname"><span class="paramname"><em>root</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<div class="fragment"><div class="line"><span class="lineno"> 183</span> {</div>
<div class="line"><span class="lineno"> 184</span> <span class="keywordflow">if</span> (root) {</div>
<div class="line"><span class="lineno"> 185</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/stack.html">std::stack&lt;Node *&gt;</a> <a class="code hl_variable" href="../../dc/dc5/paranthesis__matching_8cpp.html#aa37d24a036d239b3b528f13b9de880c7">stack</a>;</div>
<div class="line"><span class="lineno"> 186</span> <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.<a class="code hl_function" href="../../d1/dc2/classstack.html#a90df277532c23519aa7ac3c08ed90a1d">push</a>(root);</div>
<div class="line"><span class="lineno"> 187</span> </div>
<div class="line"><span class="lineno"> 188</span> <span class="keywordflow">while</span> (!<a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.empty()) {</div>
<div class="line"><span class="lineno"> 189</span> <span class="keyword">const</span> <a class="code hl_class" href="../../db/d8b/struct_node.html">Node</a> *current = <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.<a class="code hl_function" href="../../d1/dc2/classstack.html#ae09630c4384903d187801921b2ddc709">top</a>();</div>
<div class="line"><span class="lineno"> 190</span> <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.<a class="code hl_function" href="../../d1/dc2/classstack.html#a3647fb4418890f19e0dc414b8092b8b0">pop</a>();</div>
<div class="line"><span class="lineno"> 191</span> </div>
<div class="line"><span class="lineno"> 192</span> <span class="keywordflow">if</span> (current-&gt;right) {</div>
<div class="line"><span class="lineno"> 193</span> <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.<a class="code hl_function" href="../../d1/dc2/classstack.html#a90df277532c23519aa7ac3c08ed90a1d">push</a>(current-&gt;right);</div>
<div class="line"><span class="lineno"> 194</span> }</div>
<div class="line"><span class="lineno"> 195</span> <span class="keywordflow">if</span> (current-&gt;left) {</div>
<div class="line"><span class="lineno"> 196</span> <a class="code hl_class" href="../../d1/dc2/classstack.html">stack</a>.<a class="code hl_function" href="../../d1/dc2/classstack.html#a90df277532c23519aa7ac3c08ed90a1d">push</a>(current-&gt;left);</div>
<div class="line"><span class="lineno"> 197</span> }</div>
<div class="line"><span class="lineno"> 198</span> <span class="keyword">delete</span> current;</div>
<div class="line"><span class="lineno"> 199</span> }</div>
<div class="line"><span class="lineno"> 200</span> }</div>
<div class="line"><span class="lineno"> 201</span>}</div>
<div class="ttc" id="aclassstack_html"><div class="ttname"><a href="../../d1/dc2/classstack.html">stack</a></div><div class="ttdoc">for std::invalid_argument</div><div class="ttdef"><b>Definition</b> stack.hpp:19</div></div>
<div class="ttc" id="aclassstack_html_a3647fb4418890f19e0dc414b8092b8b0"><div class="ttname"><a href="../../d1/dc2/classstack.html#a3647fb4418890f19e0dc414b8092b8b0">stack::pop</a></div><div class="ttdeci">void pop()</div><div class="ttdef"><b>Definition</b> stack.hpp:62</div></div>
<div class="ttc" id="aclassstack_html_a90df277532c23519aa7ac3c08ed90a1d"><div class="ttname"><a href="../../d1/dc2/classstack.html#a90df277532c23519aa7ac3c08ed90a1d">stack::push</a></div><div class="ttdeci">void push(const value_type &amp;item)</div><div class="ttdef"><b>Definition</b> stack.hpp:47</div></div>
<div class="ttc" id="aclassstack_html_ae09630c4384903d187801921b2ddc709"><div class="ttname"><a href="../../d1/dc2/classstack.html#ae09630c4384903d187801921b2ddc709">stack::top</a></div><div class="ttdeci">value_type top() const</div><div class="ttdef"><b>Definition</b> stack.hpp:56</div></div>
<div class="ttc" id="aparanthesis__matching_8cpp_html_aa37d24a036d239b3b528f13b9de880c7"><div class="ttname"><a href="../../dc/dc5/paranthesis__matching_8cpp.html#aa37d24a036d239b3b528f13b9de880c7">stack</a></div><div class="ttdeci">char stack[MAX]</div><div class="ttdef"><b>Definition</b> paranthesis_matching.cpp:20</div></div>
<div class="ttc" id="astack_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/stack.html">std::stack</a></div></div>
<div class="ttc" id="astruct_node_html"><div class="ttname"><a href="../../db/d8b/struct_node.html">Node</a></div><div class="ttdef"><b>Definition</b> linkedlist_implentation_usingarray.cpp:14</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">&#9670;&#160;</a></span>main()</h2>
@@ -198,54 +243,56 @@ Iterative Inorder Traversal of a tree</h3>
<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<p>&lt; instace of BinaryTree, used to access its members functions.</p>
<div class="fragment"><div class="line"><span class="lineno"> 353</span> {</div>
<div class="line"><span class="lineno"> 354</span> <span class="comment">// Creating a tree with the following structure,</span></div>
<div class="line"><span class="lineno"> 355</span> <span class="comment">/*</span></div>
<div class="line"><span class="lineno"> 356</span><span class="comment"> 1</span></div>
<div class="line"><span class="lineno"> 357</span><span class="comment"> / \</span></div>
<div class="line"><span class="lineno"> 358</span><span class="comment"> 2 3</span></div>
<div class="line"><span class="lineno"> 359</span><span class="comment"> / \</span></div>
<div class="line"><span class="lineno"> 360</span><span class="comment"> 4 5</span></div>
<div class="line"><span class="lineno"> 361</span><span class="comment"> */</span></div>
<div class="line"><span class="lineno"> 362</span> </div>
<div class="line"><span class="lineno"> 363</span> <a class="code hl_class" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html">others::iterative_tree_traversals::BinaryTree</a></div>
<div class="line"><span class="lineno"> 364</span> binaryTree; <span class="comment">///&lt; instace of BinaryTree, used to access its members</span><span class="comment"></span></div>
<div class="line"><span class="lineno"> 365</span><span class="comment"> ///&lt; functions.</span></div>
<div class="line"><span class="lineno"> 366</span><span class="comment"></span> <a class="code hl_struct" href="../../d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node.html">others::iterative_tree_traversals::Node</a> *root = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(1);</div>
<div class="line"><span class="lineno"> 367</span> root-&gt;left = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(2);</div>
<div class="line"><span class="lineno"> 368</span> root-&gt;right = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(3);</div>
<div class="line"><span class="lineno"> 369</span> root-&gt;left-&gt;left = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(4);</div>
<div class="line"><span class="lineno"> 370</span> root-&gt;left-&gt;right = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(5);</div>
<div class="line"><span class="lineno"> 371</span> </div>
<div class="line"><span class="lineno"> 372</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;\n| Tests for positive data value |&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"> 373</span> <a class="code hl_function" href="../../d3/dae/dsu__path__compression_8cpp.html#ae7880ce913f3058a35ff106d5be9e243">test1</a>(binaryTree, root); <span class="comment">// run preorder-iterative test</span></div>
<div class="line"><span class="lineno"> 374</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;\nPre-order test 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"> 375</span> </div>
<div class="line"><span class="lineno"> 376</span> <a class="code hl_function" href="../../d3/dae/dsu__path__compression_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a>(binaryTree, root); <span class="comment">// run postorder-iterative test</span></div>
<div class="line"><span class="lineno"> 377</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;\nPost-order test 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"> 378</span> </div>
<div class="line"><span class="lineno"> 379</span> <a class="code hl_function" href="../../dd/d0c/hamiltons__cycle_8cpp.html#a0cc94918b6831f308d4fe4fa27f08299">test3</a>(binaryTree, root); <span class="comment">// run inorder-iterative test</span></div>
<div class="line"><span class="lineno"> 380</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;\nIn-order test 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="fragment"><div class="line"><span class="lineno"> 372</span> {</div>
<div class="line"><span class="lineno"> 373</span> <span class="comment">// Creating a tree with the following structure,</span></div>
<div class="line"><span class="lineno"> 374</span> <span class="comment">/*</span></div>
<div class="line"><span class="lineno"> 375</span><span class="comment"> 1</span></div>
<div class="line"><span class="lineno"> 376</span><span class="comment"> / \</span></div>
<div class="line"><span class="lineno"> 377</span><span class="comment"> 2 3</span></div>
<div class="line"><span class="lineno"> 378</span><span class="comment"> / \</span></div>
<div class="line"><span class="lineno"> 379</span><span class="comment"> 4 5</span></div>
<div class="line"><span class="lineno"> 380</span><span class="comment"> */</span></div>
<div class="line"><span class="lineno"> 381</span> </div>
<div class="line"><span class="lineno"> 382</span> <span class="comment">// Modifying tree for negative values.</span></div>
<div class="line"><span class="lineno"> 383</span> root-&gt;data = -1;</div>
<div class="line"><span class="lineno"> 384</span> root-&gt;left-&gt;data = -2;</div>
<div class="line"><span class="lineno"> 385</span> root-&gt;right-&gt;data = -3;</div>
<div class="line"><span class="lineno"> 386</span> root-&gt;left-&gt;left-&gt;data = -4;</div>
<div class="line"><span class="lineno"> 387</span> root-&gt;left-&gt;right-&gt;data = -5;</div>
<div class="line"><span class="lineno"> 388</span> </div>
<div class="line"><span class="lineno"> 389</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;\n| Tests for negative data values |&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"> 390</span> <a class="code hl_function" href="#a038b236fe900f7bb7e57164f5bed66c2">test4</a>(binaryTree, root); <span class="comment">// run preorder-iterative test on negative values</span></div>
<div class="line"><span class="lineno"> 391</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;\nPre-order test on-negative value 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"> 392</span> </div>
<div class="line"><span class="lineno"> 393</span> <a class="code hl_function" href="#aa9ef334cd7eb607f4eb8732566ea00b8">test5</a>(binaryTree, root); <span class="comment">// run postorder-iterative test on negative values</span></div>
<div class="line"><span class="lineno"> 394</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;\nPost-order test on-negative value 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"> 395</span> </div>
<div class="line"><span class="lineno"> 396</span> <a class="code hl_function" href="#af727f920064f2b8f484b589b60d49b89">test6</a>(binaryTree, root); <span class="comment">// run inorder-iterative test on negative values</span></div>
<div class="line"><span class="lineno"> 397</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;\nIn-order test on-negative value 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"> 398</span> </div>
<div class="line"><span class="lineno"> 399</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 400</span>}</div>
<div class="line"><span class="lineno"> 382</span> <a class="code hl_class" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html">others::iterative_tree_traversals::BinaryTree</a></div>
<div class="line"><span class="lineno"> 383</span> binaryTree; <span class="comment">///&lt; instace of BinaryTree, used to access its members</span><span class="comment"></span></div>
<div class="line"><span class="lineno"> 384</span><span class="comment"> ///&lt; functions.</span></div>
<div class="line"><span class="lineno"> 385</span><span class="comment"></span> <a class="code hl_struct" href="../../d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node.html">others::iterative_tree_traversals::Node</a> *root = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(1);</div>
<div class="line"><span class="lineno"> 386</span> root-&gt;left = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(2);</div>
<div class="line"><span class="lineno"> 387</span> root-&gt;right = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(3);</div>
<div class="line"><span class="lineno"> 388</span> root-&gt;left-&gt;left = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(4);</div>
<div class="line"><span class="lineno"> 389</span> root-&gt;left-&gt;right = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">createNewNode</a>(5);</div>
<div class="line"><span class="lineno"> 390</span> </div>
<div class="line"><span class="lineno"> 391</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;\n| Tests for positive data value |&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"> 392</span> <a class="code hl_function" href="../../d3/dae/dsu__path__compression_8cpp.html#ae7880ce913f3058a35ff106d5be9e243">test1</a>(binaryTree, root); <span class="comment">// run preorder-iterative test</span></div>
<div class="line"><span class="lineno"> 393</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;\nPre-order test 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"> 394</span> </div>
<div class="line"><span class="lineno"> 395</span> <a class="code hl_function" href="../../d3/dae/dsu__path__compression_8cpp.html#a45d94ead4cf4e1ff9f87c38bc99f59ae">test2</a>(binaryTree, root); <span class="comment">// run postorder-iterative test</span></div>
<div class="line"><span class="lineno"> 396</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;\nPost-order test 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"> 397</span> </div>
<div class="line"><span class="lineno"> 398</span> <a class="code hl_function" href="../../dd/d0c/hamiltons__cycle_8cpp.html#a0cc94918b6831f308d4fe4fa27f08299">test3</a>(binaryTree, root); <span class="comment">// run inorder-iterative test</span></div>
<div class="line"><span class="lineno"> 399</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;\nIn-order test 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"> 400</span> </div>
<div class="line"><span class="lineno"> 401</span> <span class="comment">// Modifying tree for negative values.</span></div>
<div class="line"><span class="lineno"> 402</span> root-&gt;data = -1;</div>
<div class="line"><span class="lineno"> 403</span> root-&gt;left-&gt;data = -2;</div>
<div class="line"><span class="lineno"> 404</span> root-&gt;right-&gt;data = -3;</div>
<div class="line"><span class="lineno"> 405</span> root-&gt;left-&gt;left-&gt;data = -4;</div>
<div class="line"><span class="lineno"> 406</span> root-&gt;left-&gt;right-&gt;data = -5;</div>
<div class="line"><span class="lineno"> 407</span> </div>
<div class="line"><span class="lineno"> 408</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;\n| Tests for negative data values |&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"> 409</span> <a class="code hl_function" href="#a038b236fe900f7bb7e57164f5bed66c2">test4</a>(binaryTree, root); <span class="comment">// run preorder-iterative test on negative values</span></div>
<div class="line"><span class="lineno"> 410</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;\nPre-order test on-negative value 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"> 411</span> </div>
<div class="line"><span class="lineno"> 412</span> <a class="code hl_function" href="#aa9ef334cd7eb607f4eb8732566ea00b8">test5</a>(binaryTree, root); <span class="comment">// run postorder-iterative test on negative values</span></div>
<div class="line"><span class="lineno"> 413</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;\nPost-order test on-negative value 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"> 414</span> </div>
<div class="line"><span class="lineno"> 415</span> <a class="code hl_function" href="#af727f920064f2b8f484b589b60d49b89">test6</a>(binaryTree, root); <span class="comment">// run inorder-iterative test on negative values</span></div>
<div class="line"><span class="lineno"> 416</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;\nIn-order test on-negative value 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"> 417</span> </div>
<div class="line"><span class="lineno"> 418</span> deleteAll(root);</div>
<div class="line"><span class="lineno"> 419</span> </div>
<div class="line"><span class="lineno"> 420</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 421</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="aclassothers_1_1iterative__tree__traversals_1_1_binary_tree_html"><div class="ttname"><a href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html">others::iterative_tree_traversals::BinaryTree</a></div><div class="ttdoc">defines the functions associated with the binary tree</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:67</div></div>
<div class="ttc" id="aclassothers_1_1iterative__tree__traversals_1_1_binary_tree_html_a3078a5ccf45d6a7031dcf46e43de65b6"><div class="ttname"><a href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a3078a5ccf45d6a7031dcf46e43de65b6">others::iterative_tree_traversals::BinaryTree::createNewNode</a></div><div class="ttdeci">Node * createNewNode(int64_t)</div><div class="ttdoc">function that will create new node for insertion.</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:88</div></div>
@@ -253,9 +300,9 @@ Iterative Inorder Traversal of a tree</h3>
<div class="ttc" id="adsu__path__compression_8cpp_html_ae7880ce913f3058a35ff106d5be9e243"><div class="ttname"><a href="../../d3/dae/dsu__path__compression_8cpp.html#ae7880ce913f3058a35ff106d5be9e243">test1</a></div><div class="ttdeci">static void test1()</div><div class="ttdoc">Self-test implementations, 1st test.</div><div class="ttdef"><b>Definition</b> dsu_path_compression.cpp:169</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="ahamiltons__cycle_8cpp_html_a0cc94918b6831f308d4fe4fa27f08299"><div class="ttname"><a href="../../dd/d0c/hamiltons__cycle_8cpp.html#a0cc94918b6831f308d4fe4fa27f08299">test3</a></div><div class="ttdeci">static void test3()</div><div class="ttdef"><b>Definition</b> hamiltons_cycle.cpp:122</div></div>
<div class="ttc" id="aiterative__tree__traversals_8cpp_html_a038b236fe900f7bb7e57164f5bed66c2"><div class="ttname"><a href="#a038b236fe900f7bb7e57164f5bed66c2">test4</a></div><div class="ttdeci">static void test4(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)</div><div class="ttdoc">Test the computed preorder with the actual preorder on negative value.</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:272</div></div>
<div class="ttc" id="aiterative__tree__traversals_8cpp_html_aa9ef334cd7eb607f4eb8732566ea00b8"><div class="ttname"><a href="#aa9ef334cd7eb607f4eb8732566ea00b8">test5</a></div><div class="ttdeci">static void test5(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)</div><div class="ttdoc">Test the computed postorder with the actual postorder on negative value.</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:300</div></div>
<div class="ttc" id="aiterative__tree__traversals_8cpp_html_af727f920064f2b8f484b589b60d49b89"><div class="ttname"><a href="#af727f920064f2b8f484b589b60d49b89">test6</a></div><div class="ttdeci">static void test6(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)</div><div class="ttdoc">Test the computed inorder with the actual inorder on negative value.</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:327</div></div>
<div class="ttc" id="aiterative__tree__traversals_8cpp_html_a038b236fe900f7bb7e57164f5bed66c2"><div class="ttname"><a href="#a038b236fe900f7bb7e57164f5bed66c2">test4</a></div><div class="ttdeci">static void test4(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)</div><div class="ttdoc">Test the computed preorder with the actual preorder on negative value.</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:291</div></div>
<div class="ttc" id="aiterative__tree__traversals_8cpp_html_aa9ef334cd7eb607f4eb8732566ea00b8"><div class="ttname"><a href="#aa9ef334cd7eb607f4eb8732566ea00b8">test5</a></div><div class="ttdeci">static void test5(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)</div><div class="ttdoc">Test the computed postorder with the actual postorder on negative value.</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:319</div></div>
<div class="ttc" id="aiterative__tree__traversals_8cpp_html_af727f920064f2b8f484b589b60d49b89"><div class="ttname"><a href="#af727f920064f2b8f484b589b60d49b89">test6</a></div><div class="ttdeci">static void test6(others::iterative_tree_traversals::BinaryTree binaryTree, others::iterative_tree_traversals::Node *root)</div><div class="ttdoc">Test the computed inorder with the actual inorder on negative value.</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:346</div></div>
<div class="ttc" id="astructothers_1_1iterative__tree__traversals_1_1_node_html"><div class="ttname"><a href="../../d2/d9a/structothers_1_1iterative__tree__traversals_1_1_node.html">others::iterative_tree_traversals::Node</a></div><div class="ttdoc">defines the structure of a node of the tree</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:58</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -301,26 +348,26 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<p>&lt; result stores the preorder traversal of the binary tree</p>
<div class="fragment"><div class="line"><span class="lineno"> 192</span> {</div>
<div class="line"><span class="lineno"> 193</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{1, 2, 4, 5, 3};</div>
<div class="line"><span class="lineno"> 194</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 195</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the preorder traversal of the binary tree</span></div>
<div class="line"><span class="lineno"> 196</span> </div>
<div class="line"><span class="lineno"> 197</span> <span class="comment">// Calling preOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 198</span> <span class="comment">// and storing the preorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 199</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#ad4c6a8e67fb8267a65439b035666b5ae">preOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 200</span> </div>
<div class="line"><span class="lineno"> 201</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 202</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 203</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 204</span> }</div>
<div class="line"><span class="lineno"> 205</span> </div>
<div class="line"><span class="lineno"> 206</span> <span class="comment">// Printing the result storing preorder.</span></div>
<div class="line"><span class="lineno"> 207</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;\nPreOrder Traversal Is : &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"> 208</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 209</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 210</span> }</div>
<div class="line"><span class="lineno"> 211</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 211</span> {</div>
<div class="line"><span class="lineno"> 212</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{1, 2, 4, 5, 3};</div>
<div class="line"><span class="lineno"> 213</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 214</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the preorder traversal of the binary tree</span></div>
<div class="line"><span class="lineno"> 215</span> </div>
<div class="line"><span class="lineno"> 216</span> <span class="comment">// Calling preOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 217</span> <span class="comment">// and storing the preorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 218</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#ad4c6a8e67fb8267a65439b035666b5ae">preOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 219</span> </div>
<div class="line"><span class="lineno"> 220</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 221</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 222</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 223</span> }</div>
<div class="line"><span class="lineno"> 224</span> </div>
<div class="line"><span class="lineno"> 225</span> <span class="comment">// Printing the result storing preorder.</span></div>
<div class="line"><span class="lineno"> 226</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;\nPreOrder Traversal Is : &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"> 227</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 228</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 229</span> }</div>
<div class="line"><span class="lineno"> 230</span>}</div>
<div class="ttc" id="aclassothers_1_1iterative__tree__traversals_1_1_binary_tree_html_ad4c6a8e67fb8267a65439b035666b5ae"><div class="ttname"><a href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#ad4c6a8e67fb8267a65439b035666b5ae">others::iterative_tree_traversals::BinaryTree::preOrderIterative</a></div><div class="ttdeci">std::vector&lt; int64_t &gt; preOrderIterative(Node *)</div><div class="ttdoc">preOrderIterative() function that will perform the preorder traversal iteratively,...</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:102</div></div>
<div class="ttc" id="afibonacci__sum_8cpp_html_aadb40ac4c74a7efc0680b83eeee138aa"><div class="ttname"><a href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">math::fibonacci_sum::result</a></div><div class="ttdeci">uint64_t result(uint64_t n)</div><div class="ttdef"><b>Definition</b> fibonacci_sum.cpp:76</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>
@@ -368,26 +415,26 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<p>&lt; result stores the postorder traversal of the binary tree.</p>
<div class="fragment"><div class="line"><span class="lineno"> 219</span> {</div>
<div class="line"><span class="lineno"> 220</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{4, 5, 2, 3, 1};</div>
<div class="line"><span class="lineno"> 221</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 222</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the postorder traversal of the binary tree.</span></div>
<div class="line"><span class="lineno"> 223</span> </div>
<div class="line"><span class="lineno"> 224</span> <span class="comment">// Calling postOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 225</span> <span class="comment">// and storing the postorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 226</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a636a07c90b7f312bb86d2ec104efca25">postOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 227</span> </div>
<div class="line"><span class="lineno"> 228</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 229</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 230</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 231</span> }</div>
<div class="line"><span class="lineno"> 232</span> </div>
<div class="line"><span class="lineno"> 233</span> <span class="comment">// Printing the result storing postorder.</span></div>
<div class="line"><span class="lineno"> 234</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;\nPostOrder Traversal Is : &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"> 235</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 236</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 237</span> }</div>
<div class="line"><span class="lineno"> 238</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 238</span> {</div>
<div class="line"><span class="lineno"> 239</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{4, 5, 2, 3, 1};</div>
<div class="line"><span class="lineno"> 240</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 241</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the postorder traversal of the binary tree.</span></div>
<div class="line"><span class="lineno"> 242</span> </div>
<div class="line"><span class="lineno"> 243</span> <span class="comment">// Calling postOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 244</span> <span class="comment">// and storing the postorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 245</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a636a07c90b7f312bb86d2ec104efca25">postOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 246</span> </div>
<div class="line"><span class="lineno"> 247</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 248</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 249</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 250</span> }</div>
<div class="line"><span class="lineno"> 251</span> </div>
<div class="line"><span class="lineno"> 252</span> <span class="comment">// Printing the result storing postorder.</span></div>
<div class="line"><span class="lineno"> 253</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;\nPostOrder Traversal Is : &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"> 254</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 255</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 256</span> }</div>
<div class="line"><span class="lineno"> 257</span>}</div>
<div class="ttc" id="aclassothers_1_1iterative__tree__traversals_1_1_binary_tree_html_a636a07c90b7f312bb86d2ec104efca25"><div class="ttname"><a href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a636a07c90b7f312bb86d2ec104efca25">others::iterative_tree_traversals::BinaryTree::postOrderIterative</a></div><div class="ttdeci">std::vector&lt; int64_t &gt; postOrderIterative(Node *)</div><div class="ttdoc">postOrderIterative() function that will perform the postorder traversal iteratively,...</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:132</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -433,26 +480,26 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<p>&lt; result stores the inorder traversal of the binary tree.</p>
<div class="fragment"><div class="line"><span class="lineno"> 246</span> {</div>
<div class="line"><span class="lineno"> 247</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{4, 2, 5, 1, 3};</div>
<div class="line"><span class="lineno"> 248</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 249</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the inorder traversal of the binary tree.</span></div>
<div class="line"><span class="lineno"> 250</span> </div>
<div class="line"><span class="lineno"> 251</span> <span class="comment">// Calling inOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 252</span> <span class="comment">// and storing the inorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 253</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a0c33f2c1a3a3deb486a1c33ee5239499">inOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 254</span> </div>
<div class="line"><span class="lineno"> 255</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 256</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 257</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 258</span> }</div>
<div class="line"><span class="lineno"> 259</span> </div>
<div class="line"><span class="lineno"> 260</span> <span class="comment">// Printing the result storing inorder.</span></div>
<div class="line"><span class="lineno"> 261</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;\nInOrder Traversal Is : &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"> 262</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 263</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 264</span> }</div>
<div class="line"><span class="lineno"> 265</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 265</span> {</div>
<div class="line"><span class="lineno"> 266</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{4, 2, 5, 1, 3};</div>
<div class="line"><span class="lineno"> 267</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 268</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the inorder traversal of the binary tree.</span></div>
<div class="line"><span class="lineno"> 269</span> </div>
<div class="line"><span class="lineno"> 270</span> <span class="comment">// Calling inOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 271</span> <span class="comment">// and storing the inorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 272</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a0c33f2c1a3a3deb486a1c33ee5239499">inOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 273</span> </div>
<div class="line"><span class="lineno"> 274</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 275</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 276</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 277</span> }</div>
<div class="line"><span class="lineno"> 278</span> </div>
<div class="line"><span class="lineno"> 279</span> <span class="comment">// Printing the result storing inorder.</span></div>
<div class="line"><span class="lineno"> 280</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;\nInOrder Traversal Is : &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"> 281</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 282</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 283</span> }</div>
<div class="line"><span class="lineno"> 284</span>}</div>
<div class="ttc" id="aclassothers_1_1iterative__tree__traversals_1_1_binary_tree_html_a0c33f2c1a3a3deb486a1c33ee5239499"><div class="ttname"><a href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a0c33f2c1a3a3deb486a1c33ee5239499">others::iterative_tree_traversals::BinaryTree::inOrderIterative</a></div><div class="ttdeci">std::vector&lt; int64_t &gt; inOrderIterative(Node *)</div><div class="ttdoc">inOrderIterative() function that will perform the inorder traversal iteratively, and return the resul...</div><div class="ttdef"><b>Definition</b> iterative_tree_traversals.cpp:164</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -498,26 +545,26 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<p>&lt; result stores the preorder traversal of the binary tree</p>
<div class="fragment"><div class="line"><span class="lineno"> 273</span> {</div>
<div class="line"><span class="lineno"> 274</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{-1, -2, -4, -5, -3};</div>
<div class="line"><span class="lineno"> 275</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 276</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the preorder traversal of the binary tree</span></div>
<div class="line"><span class="lineno"> 277</span> </div>
<div class="line"><span class="lineno"> 278</span> <span class="comment">// Calling preOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 279</span> <span class="comment">// and storing the preorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 280</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#ad4c6a8e67fb8267a65439b035666b5ae">preOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 281</span> </div>
<div class="line"><span class="lineno"> 282</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 283</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 284</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 285</span> }</div>
<div class="line"><span class="lineno"> 286</span> </div>
<div class="line"><span class="lineno"> 287</span> <span class="comment">// Printing the result storing preorder.</span></div>
<div class="line"><span class="lineno"> 288</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;\nPreOrder Traversal Is : &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"> 289</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 290</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 291</span> }</div>
<div class="line"><span class="lineno"> 292</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 292</span> {</div>
<div class="line"><span class="lineno"> 293</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{-1, -2, -4, -5, -3};</div>
<div class="line"><span class="lineno"> 294</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 295</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the preorder traversal of the binary tree</span></div>
<div class="line"><span class="lineno"> 296</span> </div>
<div class="line"><span class="lineno"> 297</span> <span class="comment">// Calling preOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 298</span> <span class="comment">// and storing the preorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 299</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#ad4c6a8e67fb8267a65439b035666b5ae">preOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 300</span> </div>
<div class="line"><span class="lineno"> 301</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 302</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 303</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 304</span> }</div>
<div class="line"><span class="lineno"> 305</span> </div>
<div class="line"><span class="lineno"> 306</span> <span class="comment">// Printing the result storing preorder.</span></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; <span class="stringliteral">&quot;\nPreOrder Traversal Is : &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"> 308</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 309</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 310</span> }</div>
<div class="line"><span class="lineno"> 311</span>}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -562,26 +609,26 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<p>&lt; result stores the postorder traversal of the binary tree.</p>
<div class="fragment"><div class="line"><span class="lineno"> 301</span> {</div>
<div class="line"><span class="lineno"> 302</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{-4, -5, -2, -3, -1};</div>
<div class="line"><span class="lineno"> 303</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 304</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the postorder traversal of the binary tree.</span></div>
<div class="line"><span class="lineno"> 305</span> </div>
<div class="line"><span class="lineno"> 306</span> <span class="comment">// Calling postOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 307</span> <span class="comment">// and storing the postorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 308</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a636a07c90b7f312bb86d2ec104efca25">postOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 309</span> </div>
<div class="line"><span class="lineno"> 310</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 311</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 312</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 313</span> }</div>
<div class="line"><span class="lineno"> 314</span> </div>
<div class="line"><span class="lineno"> 315</span> <span class="comment">// Printing the result storing postorder.</span></div>
<div class="line"><span class="lineno"> 316</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;\nPostOrder Traversal Is : &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> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 318</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 319</span> }</div>
<div class="line"><span class="lineno"> 320</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 320</span> {</div>
<div class="line"><span class="lineno"> 321</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{-4, -5, -2, -3, -1};</div>
<div class="line"><span class="lineno"> 322</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 323</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the postorder traversal of the binary tree.</span></div>
<div class="line"><span class="lineno"> 324</span> </div>
<div class="line"><span class="lineno"> 325</span> <span class="comment">// Calling postOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 326</span> <span class="comment">// and storing the postorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 327</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a636a07c90b7f312bb86d2ec104efca25">postOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 328</span> </div>
<div class="line"><span class="lineno"> 329</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 330</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 331</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 332</span> }</div>
<div class="line"><span class="lineno"> 333</span> </div>
<div class="line"><span class="lineno"> 334</span> <span class="comment">// Printing the result storing postorder.</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;\nPostOrder Traversal Is : &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"> 336</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 337</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 338</span> }</div>
<div class="line"><span class="lineno"> 339</span>}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -626,26 +673,26 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<p>&lt; result stores the inorder traversal of the binary tree.</p>
<div class="fragment"><div class="line"><span class="lineno"> 328</span> {</div>
<div class="line"><span class="lineno"> 329</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{-4, -2, -5, -1, -3};</div>
<div class="line"><span class="lineno"> 330</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 331</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the inorder traversal of the binary tree.</span></div>
<div class="line"><span class="lineno"> 332</span> </div>
<div class="line"><span class="lineno"> 333</span> <span class="comment">// Calling inOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 334</span> <span class="comment">// and storing the inorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 335</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a0c33f2c1a3a3deb486a1c33ee5239499">inOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 336</span> </div>
<div class="line"><span class="lineno"> 337</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 338</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 339</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 340</span> }</div>
<div class="line"><span class="lineno"> 341</span> </div>
<div class="line"><span class="lineno"> 342</span> <span class="comment">// Printing the result storing inorder.</span></div>
<div class="line"><span class="lineno"> 343</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;\nInOrder Traversal Is : &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"> 344</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 345</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 346</span> }</div>
<div class="line"><span class="lineno"> 347</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 347</span> {</div>
<div class="line"><span class="lineno"> 348</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a> actual_result{-4, -2, -5, -1, -3};</div>
<div class="line"><span class="lineno"> 349</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector&lt;int64_t&gt;</a></div>
<div class="line"><span class="lineno"> 350</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>; <span class="comment">///&lt; result stores the inorder traversal of the binary tree.</span></div>
<div class="line"><span class="lineno"> 351</span> </div>
<div class="line"><span class="lineno"> 352</span> <span class="comment">// Calling inOrderIterative() function by passing a root node,</span></div>
<div class="line"><span class="lineno"> 353</span> <span class="comment">// and storing the inorder traversal in result.</span></div>
<div class="line"><span class="lineno"> 354</span> <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a> = binaryTree.<a class="code hl_function" href="../../d9/d12/classothers_1_1iterative__tree__traversals_1_1_binary_tree.html#a0c33f2c1a3a3deb486a1c33ee5239499">inOrderIterative</a>(root);</div>
<div class="line"><span class="lineno"> 355</span> </div>
<div class="line"><span class="lineno"> 356</span> <span class="comment">// Self-testing the result using `assert`</span></div>
<div class="line"><span class="lineno"> 357</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code hl_function" href="../../de/dc3/fibonacci__sum_8cpp.html#aadb40ac4c74a7efc0680b83eeee138aa">result</a>.size(); i++) {</div>
<div class="line"><span class="lineno"> 358</span> assert(actual_result[i] == result[i]);</div>
<div class="line"><span class="lineno"> 359</span> }</div>
<div class="line"><span class="lineno"> 360</span> </div>
<div class="line"><span class="lineno"> 361</span> <span class="comment">// Printing the result storing inorder.</span></div>
<div class="line"><span class="lineno"> 362</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;\nInOrder Traversal Is : &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"> 363</span> <span class="keywordflow">for</span> (<span class="keyword">auto</span> i : result) {</div>
<div class="line"><span class="lineno"> 364</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; i &lt;&lt; <span class="stringliteral">&quot; &quot;</span>;</div>
<div class="line"><span class="lineno"> 365</span> }</div>
<div class="line"><span class="lineno"> 366</span>}</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">