Include dependency graph for binary_search_tree.c:</div>
<divclass="dyncontent">
<divclass="center"><iframescrolling="no"frameborder="0"src="../../d8/d1c/binary__search__tree_8c__incl.svg"width="194"height="127"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<trclass="memdesc:"><tdclass="mdescLeft"> </td><tdclass="mdescRight"><aclass="el"href="../../db/d8b/struct_node.html"title="Node, the basic data structure of the tree.">Node</a>, the basic data structure in the tree. <ahref="../../d5/da1/structnode.html#details">More...</a><br/></td></tr>
<trclass="memdesc:af4aeda155dbe167f1c1cf38cb65bf324"><tdclass="mdescLeft"> </td><tdclass="mdescRight"><aclass="el"href="../../db/d8b/struct_node.html"title="Node, the basic data structure of the tree.">Node</a>, the basic data structure in the tree. <br/></td></tr>
<trclass="memdesc:ac73c73be92dbbeeaad942c0103b9540d"><tdclass="mdescLeft"> </td><tdclass="mdescRight">The node constructor, which receives the key value input and returns a node pointer. <ahref="../../da/d02/binary__search__tree_8c.html#ac73c73be92dbbeeaad942c0103b9540d">More...</a><br/></td></tr>
<trclass="memitem:a73152b9ccb4aa5cd4c1bacd4188bb2de"><tdclass="memItemLeft"align="right"valign="top"><aclass="el"href="../../d5/da1/structnode.html">node</a> * </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../da/d02/binary__search__tree_8c.html#a73152b9ccb4aa5cd4c1bacd4188bb2de">insert</a> (<aclass="el"href="../../d5/da1/structnode.html">node</a> *root, int <aclass="el"href="../../df/dea/structdata.html">data</a>)</td></tr>
<trclass="memdesc:a73152b9ccb4aa5cd4c1bacd4188bb2de"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Insertion procedure, which inserts the input key in a new node in the tree. <ahref="../../da/d02/binary__search__tree_8c.html#a73152b9ccb4aa5cd4c1bacd4188bb2de">More...</a><br/></td></tr>
<trclass="memdesc:ad297e528a7bb8604ca93af149d609150"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Utilitary procedure to find the greatest key in the left subtree. <ahref="../../da/d02/binary__search__tree_8c.html#ad297e528a7bb8604ca93af149d609150">More...</a><br/></td></tr>
<trclass="memitem:a748f3966920e2fd197906be1e151b127"><tdclass="memItemLeft"align="right"valign="top"><aclass="el"href="../../d5/da1/structnode.html">node</a> * </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../da/d02/binary__search__tree_8c.html#a748f3966920e2fd197906be1e151b127">delete</a> (<aclass="el"href="../../d5/da1/structnode.html">node</a> *root, int <aclass="el"href="../../df/dea/structdata.html">data</a>)</td></tr>
<trclass="memdesc:a748f3966920e2fd197906be1e151b127"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Deletion procedure, which searches for the input key in the tree and removes it if present. <ahref="../../da/d02/binary__search__tree_8c.html#a748f3966920e2fd197906be1e151b127">More...</a><br/></td></tr>
<trclass="memitem:adff4c6248834a9944a1fb03a20230c9c"><tdclass="memItemLeft"align="right"valign="top">int </td><tdclass="memItemRight"valign="bottom"><aclass="el"href="../../da/d02/binary__search__tree_8c.html#adff4c6248834a9944a1fb03a20230c9c">find</a> (<aclass="el"href="../../d5/da1/structnode.html">node</a> *root, int <aclass="el"href="../../df/dea/structdata.html">data</a>)</td></tr>
<trclass="memdesc:adff4c6248834a9944a1fb03a20230c9c"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Search procedure, which looks for the input key in the tree and returns 1 if it's present or 0 if it's not in the tree. <ahref="../../da/d02/binary__search__tree_8c.html#adff4c6248834a9944a1fb03a20230c9c">More...</a><br/></td></tr>
<trclass="memdesc:ae4a66d8b0c2b0d626aea45977e358c83"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Utilitary procedure to measure the height of the binary tree. <ahref="../../da/d02/binary__search__tree_8c.html#ae4a66d8b0c2b0d626aea45977e358c83">More...</a><br/></td></tr>
<trclass="memdesc:a01151353aa2d9688934ed39208133241"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Utilitary procedure to free all nodes in a tree. <ahref="../../da/d02/binary__search__tree_8c.html#a01151353aa2d9688934ed39208133241">More...</a><br/></td></tr>
<trclass="memdesc:a0f18adaaca5ecc410cfa16dd2a3684dc"><tdclass="mdescLeft"> </td><tdclass="mdescRight">Traversal procedure to list the current keys in the tree in order of value (from the left to the right) <ahref="../../da/d02/binary__search__tree_8c.html#a0f18adaaca5ecc410cfa16dd2a3684dc">More...</a><br/></td></tr>
<divclass="line"><aname="l00096"></a><spanclass="lineno"> 96</span>  { <spanclass="comment">// If the input key is greater than the root's, search in the right</span></div>
<divclass="line"><aname="l00101"></a><spanclass="lineno"> 101</span>  { <spanclass="comment">// If the input key is lower than the root's, search in the left subtree</span></div>
<divclass="line"><aname="l00106"></a><spanclass="lineno"> 106</span> <spanclass="comment">// If the input key matches the root's, check the following cases</span></div>
<divclass="line"><aname="l00109"></a><spanclass="lineno"> 109</span>  { <spanclass="comment">// Case 1: the root has no leaves, remove the node</span></div>
<divclass="line"><aname="l00114"></a><spanclass="lineno"> 114</span>  { <spanclass="comment">// Case 2: the root has one leaf, make the leaf the new root and</span></div>
<divclass="line"><aname="l00130"></a><spanclass="lineno"> 130</span>  { <spanclass="comment">// Case 3: the root has 2 leaves, find the greatest key in the left</span></div>
<divclass="line"><aname="l00131"></a><spanclass="lineno"> 131</span> <spanclass="comment">// subtree and switch with the root's</span></div>
<divclass="line"><aname="l00133"></a><spanclass="lineno"> 133</span> <spanclass="comment">// finds the biggest node in the left branch.</span></div>
<divclass="line"><aname="l00136"></a><spanclass="lineno"> 136</span> <spanclass="comment">// sets the data of this node equal to the data of the biggest node</span></div>
<divclass="ttc"id="abinary__search__tree_8c_html_ad297e528a7bb8604ca93af149d609150"><divclass="ttname"><ahref="../../da/d02/binary__search__tree_8c.html#ad297e528a7bb8604ca93af149d609150">getMax</a></div><divclass="ttdeci">node * getMax(node *root)</div><divclass="ttdoc">Utilitary procedure to find the greatest key in the left subtree.</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:72</div></div>
<divclass="ttc"id="amalloc__dbg_8h_html_a9cc854374299a1dd933bf62029761768"><divclass="ttname"><ahref="../../d2/ddd/malloc__dbg_8h.html#a9cc854374299a1dd933bf62029761768">free</a></div><divclass="ttdeci">#define free(ptr)</div><divclass="ttdoc">This macro replace the standard free function with free_dbg.</div><divclass="ttdef"><b>Definition:</b> malloc_dbg.h:26</div></div>
<divclass="ttc"id="astructnode_html"><divclass="ttname"><ahref="../../d5/da1/structnode.html">node</a></div><divclass="ttdoc">Node, the basic data structure in the tree.</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:15</div></div>
<divclass="ttc"id="astructnode_html_a2d890bb9f6af0ffd73fe79b21124c2a2"><divclass="ttname"><ahref="../../d5/da1/structnode.html#a2d890bb9f6af0ffd73fe79b21124c2a2">node::data</a></div><divclass="ttdeci">int data</div><divclass="ttdoc">data of the node</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:18</div></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../da/d02/binary__search__tree_8c_a748f3966920e2fd197906be1e151b127_cgraph.svg"width="182"height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="line"><aname="l00154"></a><spanclass="lineno"> 154</span> <spanclass="comment">// If the root is null, the key's not present</span></div>
<divclass="line"><aname="l00161"></a><spanclass="lineno"> 161</span> <spanclass="comment">// If the input key is greater than the root's, search in the right</span></div>
<divclass="line"><aname="l00167"></a><spanclass="lineno"> 167</span> <spanclass="comment">// If the input key is lower than the root's, search in the left subtree</span></div>
<divclass="line"><aname="l00172"></a><spanclass="lineno"> 172</span> <spanclass="comment">// If the input and the root key match, return 1</span></div>
<divclass="ttc"id="abinary__search__tree_8c_html_adff4c6248834a9944a1fb03a20230c9c"><divclass="ttname"><ahref="../../da/d02/binary__search__tree_8c.html#adff4c6248834a9944a1fb03a20230c9c">find</a></div><divclass="ttdeci">int find(node *root, int data)</div><divclass="ttdoc">Search procedure, which looks for the input key in the tree and returns 1 if it's present or 0 if it'...</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:152</div></div>
<divclass="line"><aname="l00074"></a><spanclass="lineno"> 74</span> <spanclass="comment">// If there's no leaf to the right, then this is the maximum key value</span></div>
<divclass="line"><aname="l00189"></a><spanclass="lineno"> 189</span> <spanclass="comment">// If the root is null, this is the bottom of the tree (height 0)</span></div>
<divclass="line"><aname="l00196"></a><spanclass="lineno"> 196</span> <spanclass="comment">// Get the height from both left and right subtrees to check which is</span></div>
<divclass="line"><aname="l00197"></a><spanclass="lineno"> 197</span> <spanclass="comment">// the greatest</span></div>
<divclass="line"><aname="l00201"></a><spanclass="lineno"> 201</span> <spanclass="comment">// The final height is the height of the greatest subtree(left or right)</span></div>
<divclass="line"><aname="l00202"></a><spanclass="lineno"> 202</span> <spanclass="comment">// plus 1(which is the root's level)</span></div>
<divclass="ttc"id="abinary__search__tree_8c_html_ae4a66d8b0c2b0d626aea45977e358c83"><divclass="ttname"><ahref="../../da/d02/binary__search__tree_8c.html#ae4a66d8b0c2b0d626aea45977e358c83">height</a></div><divclass="ttdeci">int height(node *root)</div><divclass="ttdoc">Utilitary procedure to measure the height of the binary tree.</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:187</div></div>
<divclass="ttc"id="abinary__search__tree_8c_html_a0f18adaaca5ecc410cfa16dd2a3684dc"><divclass="ttname"><ahref="../../da/d02/binary__search__tree_8c.html#a0f18adaaca5ecc410cfa16dd2a3684dc">inOrder</a></div><divclass="ttdeci">void inOrder(node *root)</div><divclass="ttdoc">Traversal procedure to list the current keys in the tree in order of value (from the left to the righ...</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:238</div></div>
<divclass="line"><aname="l00048"></a><spanclass="lineno"> 48</span> <spanclass="comment">// If the root of the subtree is null, insert key here</span></div>
<divclass="line"><aname="l00055"></a><spanclass="lineno"> 55</span> <spanclass="comment">// If it isn't null and the input key is greater than the root key,</span></div>
<divclass="line"><aname="l00056"></a><spanclass="lineno"> 56</span> <spanclass="comment">// insert in the right leaf</span></div>
<divclass="line"><aname="l00060"></a><spanclass="lineno"> 60</span>  { <spanclass="comment">// If it isn't null and the input key is lower than the root key, insert</span></div>
<divclass="line"><aname="l00061"></a><spanclass="lineno"> 61</span> <spanclass="comment">// in the left leaf</span></div>
<divclass="ttc"id="abinary__search__tree_8c_html_a73152b9ccb4aa5cd4c1bacd4188bb2de"><divclass="ttname"><ahref="../../da/d02/binary__search__tree_8c.html#a73152b9ccb4aa5cd4c1bacd4188bb2de">insert</a></div><divclass="ttdeci">node * insert(node *root, int data)</div><divclass="ttdoc">Insertion procedure, which inserts the input key in a new node in the tree.</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:46</div></div>
<divclass="ttc"id="abinary__search__tree_8c_html_ac73c73be92dbbeeaad942c0103b9540d"><divclass="ttname"><ahref="../../da/d02/binary__search__tree_8c.html#ac73c73be92dbbeeaad942c0103b9540d">newNode</a></div><divclass="ttdeci">node * newNode(int data)</div><divclass="ttdoc">The node constructor, which receives the key value input and returns a node pointer.</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:28</div></div>
<divclass="center"><iframescrolling="no"frameborder="0"src="../../da/d02/binary__search__tree_8c_a73152b9ccb4aa5cd4c1bacd4188bb2de_cgraph.svg"width="191"height="38"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe>
<divclass="ttc"id="amalloc__dbg_8h_html_a725f50ecaf1959d96de79b36b4788fee"><divclass="ttname"><ahref="../../d2/ddd/malloc__dbg_8h.html#a725f50ecaf1959d96de79b36b4788fee">malloc</a></div><divclass="ttdeci">#define malloc(bytes)</div><divclass="ttdoc">This macro replace the standard malloc function with malloc_dbg.</div><divclass="ttdef"><b>Definition:</b> malloc_dbg.h:18</div></div>
<divclass="ttc"id="abinary__search__tree_8c_html_a01151353aa2d9688934ed39208133241"><divclass="ttname"><ahref="../../da/d02/binary__search__tree_8c.html#a01151353aa2d9688934ed39208133241">purge</a></div><divclass="ttdeci">void purge(node *root)</div><divclass="ttdoc">Utilitary procedure to free all nodes in a tree.</div><divclass="ttdef"><b>Definition:</b> binary_search_tree.c:217</div></div>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="../../doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.9.1 </li>