Skip to content

Commit

Permalink
Documentation for 490974e
Browse files Browse the repository at this point in the history
  • Loading branch information
realstealthninja committed Sep 4, 2024
1 parent b81e962 commit 2fb0f6c
Showing 1 changed file with 74 additions and 53 deletions.
127 changes: 74 additions & 53 deletions d8/dfa/median__search2_8cpp.html
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@
Functions</h2></td></tr>
<tr class="memitem:a5fefe132a0c3ee780ebc703f37ebce6a" id="r_a5fefe132a0c3ee780ebc703f37ebce6a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="../../d7/da4/struct_list_node.html">ListNode</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5fefe132a0c3ee780ebc703f37ebce6a">search::median_search2::middleNode</a> (<a class="el" href="../../d7/da4/struct_list_node.html">ListNode</a> *head)</td></tr>
<tr class="separator:a5fefe132a0c3ee780ebc703f37ebce6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a565d9d4b66467f966b4e4f8ea2a2ef09" id="r_a565d9d4b66467f966b4e4f8ea2a2ef09"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a565d9d4b66467f966b4e4f8ea2a2ef09">search::median_search2::deleteAll</a> (const <a class="el" href="../../d7/da4/struct_list_node.html">ListNode</a> *const head)</td></tr>
<tr class="separator:a565d9d4b66467f966b4e4f8ea2a2ef09"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d" id="r_aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self-test implementations. <br /></td></tr>
<tr class="separator:aa8dca7b867074164d5f45b0f3851269d"><td class="memSeparator" colspan="2">&#160;</td></tr>
Expand All @@ -157,6 +159,29 @@
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/weiss-ben" target="_blank">Benjamin Weiss</a> </dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="../../d9/d69/median__search_8cpp.html" title="Implementation of Median search algorithm. @cases from here">median_search.cpp</a> </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a565d9d4b66467f966b4e4f8ea2a2ef09" name="a565d9d4b66467f966b4e4f8ea2a2ef09"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a565d9d4b66467f966b4e4f8ea2a2ef09">&#9670;&#160;</a></span>deleteAll()</h2>

<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void search::median_search2::deleteAll </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="../../d7/da4/struct_list_node.html">ListNode</a> *const</td> <td class="paramname"><span class="paramname"><em>head</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<div class="fragment"><div class="line"><span class="lineno"> 77</span> {</div>
<div class="line"><span class="lineno"> 78</span> <span class="keywordflow">if</span> (head) {</div>
<div class="line"><span class="lineno"> 79</span> deleteAll(head-&gt;next);</div>
<div class="line"><span class="lineno"> 80</span> <span class="keyword">delete</span> head;</div>
<div class="line"><span class="lineno"> 81</span> }</div>
<div class="line"><span class="lineno"> 82</span>}</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>

Expand All @@ -174,11 +199,11 @@ <h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a7

<p>Main function. </p>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 136</span> {</div>
<div class="line"><span class="lineno"> 137</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><span class="lineno"> 138</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 139</span>}</div>
<div class="ttc" id="amedian__search2_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> median_search2.cpp:83</div></div>
<div class="fragment"><div class="line"><span class="lineno"> 139</span> {</div>
<div class="line"><span class="lineno"> 140</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
<div class="line"><span class="lineno"> 141</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><span class="lineno"> 142</span>}</div>
<div class="ttc" id="amedian__search2_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> median_search2.cpp:90</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
Expand Down Expand Up @@ -260,54 +285,50 @@ <h2 class="memtitle"><span class="permalink"><a href="#aa8dca7b867074164d5f45b0f

<p>Self-test implementations. </p>
<dl class="section return"><dt>Returns</dt><dd>void </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 83</span> {</div>
<div class="line"><span class="lineno"> 84</span> <span class="keyword">auto</span>* head1 = <span class="keyword">new</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>;</div>
<div class="line"><span class="lineno"> 85</span> head1-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a> = 1;</div>
<div class="line"><span class="lineno"> 86</span> </div>
<div class="line"><span class="lineno"> 87</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>* temp = head1;</div>
<div class="line"><span class="lineno"> 88</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 2; i &lt; 6; ++i) {</div>
<div class="line"><span class="lineno"> 89</span> <span class="comment">// Allocate next</span></div>
<div class="line"><span class="lineno"> 90</span> <span class="keyword">auto</span>* temp1 = <span class="keyword">new</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>;</div>
<div class="line"><span class="lineno"> 91</span> temp1-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a> = i;</div>
<div class="line"><span class="lineno"> 92</span> </div>
<div class="line"><span class="lineno"> 93</span> <span class="comment">// Advance</span></div>
<div class="line"><span class="lineno"> 94</span> temp-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1">next</a> = temp1;</div>
<div class="line"><span class="lineno"> 95</span> temp = temp1;</div>
<div class="line"><span class="lineno"> 96</span> }</div>
<div class="line"><span class="lineno"> 97</span> temp-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1">next</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><span class="lineno"> 98</span> </div>
<div class="line"><span class="lineno"> 99</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>* median = <a class="code hl_function" href="#a5fefe132a0c3ee780ebc703f37ebce6a">search::median_search2::middleNode</a>(head1);</div>
<div class="line"><span class="lineno"> 100</span> assert(3 == median-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a>); <span class="comment">// 3 is the value of the median node.</span></div>
<div class="line"><span class="lineno"> 101</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;test case:1 passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 102</span> </div>
<div class="line"><span class="lineno"> 103</span> <span class="comment">// Test case # 2</span></div>
<div class="line"><span class="lineno"> 104</span> <span class="keyword">auto</span>* head2 = <span class="keyword">new</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>;</div>
<div class="line"><span class="lineno"> 105</span> head2-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a> = 1;</div>
<div class="line"><span class="lineno"> 106</span> </div>
<div class="line"><span class="lineno"> 107</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>* temp2 = head2;</div>
<div class="line"><span class="lineno"> 108</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 2; i &lt; 7; ++i) {</div>
<div class="line"><span class="lineno"> 109</span> <span class="comment">// Allocate next</span></div>
<div class="line"><span class="lineno"> 110</span> <span class="keyword">auto</span>* temp3 = <span class="keyword">new</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>;</div>
<div class="line"><span class="lineno"> 111</span> temp3-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a> = i;</div>
<div class="line"><span class="lineno"> 112</span> </div>
<div class="line"><span class="lineno"> 113</span> <span class="comment">// Advance</span></div>
<div class="line"><span class="lineno"> 114</span> temp2-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1">next</a> = temp3;</div>
<div class="line"><span class="lineno"> 115</span> temp2 = temp3;</div>
<div class="line"><span class="lineno"> 116</span> }</div>
<div class="line"><span class="lineno"> 117</span> temp2-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1">next</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><span class="lineno"> 118</span> </div>
<div class="line"><span class="lineno"> 119</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>* median1 = <a class="code hl_function" href="#a5fefe132a0c3ee780ebc703f37ebce6a">search::median_search2::middleNode</a>(head2);</div>
<div class="line"><span class="lineno"> 120</span> assert(4 == median1-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a>); <span class="comment">// 4 is the value of the median node.</span></div>
<div class="line"><span class="lineno"> 121</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;test case:2 passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 122</span> </div>
<div class="line"><span class="lineno"> 123</span> <span class="keyword">delete</span> head1;</div>
<div class="line"><span class="lineno"> 124</span> <span class="keyword">delete</span> temp;</div>
<div class="line"><span class="lineno"> 125</span> </div>
<div class="line"><span class="lineno"> 126</span> <span class="keyword">delete</span> head2;</div>
<div class="line"><span class="lineno"> 127</span> <span class="keyword">delete</span> temp2;</div>
<div class="line"><span class="lineno"> 128</span> </div>
<div class="line"><span class="lineno"> 129</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;--All tests passed--\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 130</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 90</span> {</div>
<div class="line"><span class="lineno"> 91</span> <span class="keyword">auto</span>* head1 = <span class="keyword">new</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>;</div>
<div class="line"><span class="lineno"> 92</span> head1-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a> = 1;</div>
<div class="line"><span class="lineno"> 93</span> </div>
<div class="line"><span class="lineno"> 94</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>* temp = head1;</div>
<div class="line"><span class="lineno"> 95</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 2; i &lt; 6; ++i) {</div>
<div class="line"><span class="lineno"> 96</span> <span class="comment">// Allocate next</span></div>
<div class="line"><span class="lineno"> 97</span> <span class="keyword">auto</span>* temp1 = <span class="keyword">new</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>;</div>
<div class="line"><span class="lineno"> 98</span> temp1-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a> = i;</div>
<div class="line"><span class="lineno"> 99</span> </div>
<div class="line"><span class="lineno"> 100</span> <span class="comment">// Advance</span></div>
<div class="line"><span class="lineno"> 101</span> temp-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1">next</a> = temp1;</div>
<div class="line"><span class="lineno"> 102</span> temp = temp1;</div>
<div class="line"><span class="lineno"> 103</span> }</div>
<div class="line"><span class="lineno"> 104</span> temp-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1">next</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><span class="lineno"> 105</span> </div>
<div class="line"><span class="lineno"> 106</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>* median = <a class="code hl_function" href="#a5fefe132a0c3ee780ebc703f37ebce6a">search::median_search2::middleNode</a>(head1);</div>
<div class="line"><span class="lineno"> 107</span> assert(3 == median-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a>); <span class="comment">// 3 is the value of the median node.</span></div>
<div class="line"><span class="lineno"> 108</span> search::median_search2::deleteAll(head1);</div>
<div class="line"><span class="lineno"> 109</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;test case:1 passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 110</span> </div>
<div class="line"><span class="lineno"> 111</span> <span class="comment">// Test case # 2</span></div>
<div class="line"><span class="lineno"> 112</span> <span class="keyword">auto</span>* head2 = <span class="keyword">new</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>;</div>
<div class="line"><span class="lineno"> 113</span> head2-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a> = 1;</div>
<div class="line"><span class="lineno"> 114</span> </div>
<div class="line"><span class="lineno"> 115</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>* temp2 = head2;</div>
<div class="line"><span class="lineno"> 116</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 2; i &lt; 7; ++i) {</div>
<div class="line"><span class="lineno"> 117</span> <span class="comment">// Allocate next</span></div>
<div class="line"><span class="lineno"> 118</span> <span class="keyword">auto</span>* temp3 = <span class="keyword">new</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>;</div>
<div class="line"><span class="lineno"> 119</span> temp3-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a> = i;</div>
<div class="line"><span class="lineno"> 120</span> </div>
<div class="line"><span class="lineno"> 121</span> <span class="comment">// Advance</span></div>
<div class="line"><span class="lineno"> 122</span> temp2-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1">next</a> = temp3;</div>
<div class="line"><span class="lineno"> 123</span> temp2 = temp3;</div>
<div class="line"><span class="lineno"> 124</span> }</div>
<div class="line"><span class="lineno"> 125</span> temp2-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#ad78b392c2ddc25c3243d0c2f30692fb1">next</a> = <span class="keyword">nullptr</span>;</div>
<div class="line"><span class="lineno"> 126</span> </div>
<div class="line"><span class="lineno"> 127</span> <a class="code hl_struct" href="../../d7/da4/struct_list_node.html">ListNode</a>* median1 = <a class="code hl_function" href="#a5fefe132a0c3ee780ebc703f37ebce6a">search::median_search2::middleNode</a>(head2);</div>
<div class="line"><span class="lineno"> 128</span> assert(4 == median1-&gt;<a class="code hl_variable" href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">val</a>); <span class="comment">// 4 is the value of the median node.</span></div>
<div class="line"><span class="lineno"> 129</span> search::median_search2::deleteAll(head2);</div>
<div class="line"><span class="lineno"> 130</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;test case:2 passed\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 131</span> </div>
<div class="line"><span class="lineno"> 132</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;--All tests passed--\n&quot;</span>;</div>
<div class="line"><span class="lineno"> 133</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="amedian__search2_8cpp_html_a5fefe132a0c3ee780ebc703f37ebce6a"><div class="ttname"><a href="#a5fefe132a0c3ee780ebc703f37ebce6a">search::median_search2::middleNode</a></div><div class="ttdeci">ListNode * middleNode(ListNode *head)</div><div class="ttdef"><b>Definition</b> median_search2.cpp:59</div></div>
<div class="ttc" id="astruct_list_node_html_a58389d1d1fc5430c2f4ce7c5d5dc48b3"><div class="ttname"><a href="../../d7/da4/struct_list_node.html#a58389d1d1fc5430c2f4ce7c5d5dc48b3">ListNode::val</a></div><div class="ttdeci">int val</div><div class="ttdoc">the value stored in the node</div><div class="ttdef"><b>Definition</b> median_search2.cpp:32</div></div>
Expand Down

0 comments on commit 2fb0f6c

Please sign in to comment.