Skip to content

Commit

Permalink
Documentation for 1f5828e
Browse files Browse the repository at this point in the history
  • Loading branch information
realstealthninja committed Aug 31, 2024
1 parent 6c9c7c7 commit 20cd9a9
Show file tree
Hide file tree
Showing 18 changed files with 300 additions and 257 deletions.
36 changes: 20 additions & 16 deletions d5/d91/namespacesorting.html
Original file line number Diff line number Diff line change
Expand Up @@ -974,19 +974,23 @@ <h2 class="memtitle"><span class="permalink"><a href="#affc6ee160142cd017f8c4b21
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>new array with elements sorted from a given array </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 51</span> {</div>
<div class="line"><span class="lineno"> 52</span> <span class="comment">// Untill array is not sorted</span></div>
<div class="line"><span class="lineno"> 53</span> <span class="keywordflow">while</span> (!<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/begin.html">begin</a>(), arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/end.html">end</a>())) {</div>
<div class="line"><span class="lineno"> 54</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/random_shuffle.html">std::random_shuffle</a>(arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/begin.html">begin</a>(), arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/end.html">end</a>());<span class="comment">// Shuffle the array</span></div>
<div class="line"><span class="lineno"> 55</span> }</div>
<div class="line"><span class="lineno"> 56</span> <span class="keywordflow">return</span> arr;</div>
<div class="line"><span class="lineno"> 57</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 52</span> {</div>
<div class="line"><span class="lineno"> 53</span> <span class="comment">// Untill array is not sorted</span></div>
<div class="line"><span class="lineno"> 54</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/random_device.html">std::random_device</a> random_device;</div>
<div class="line"><span class="lineno"> 55</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine.html">std::mt19937</a> generator(random_device());</div>
<div class="line"><span class="lineno"> 56</span> <span class="keywordflow">while</span> (!<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a>(arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/begin.html">begin</a>(), arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/end.html">end</a>())) {</div>
<div class="line"><span class="lineno"> 57</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/random_shuffle.html">std::shuffle</a>(arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/begin.html">begin</a>(), arr.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/array/end.html">end</a>(), generator);<span class="comment">// Shuffle the array</span></div>
<div class="line"><span class="lineno"> 58</span> }</div>
<div class="line"><span class="lineno"> 59</span> <span class="keywordflow">return</span> arr;</div>
<div class="line"><span class="lineno"> 60</span>}</div>
<div class="ttc" id="ais_sorted_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/is_sorted.html">std::is_sorted</a></div><div class="ttdeci">T is_sorted(T... args)</div></div>
<div class="ttc" id="arandom_shuffle_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/random_shuffle.html">std::random_shuffle</a></div><div class="ttdeci">T random_shuffle(T... args)</div></div>
<div class="ttc" id="amersenne_twister_engine_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/random/mersenne_twister_engine.html">std::mt19937</a></div></div>
<div class="ttc" id="arandom_device_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/random/random_device.html">std::random_device</a></div></div>
<div class="ttc" id="arandom_shuffle_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/random_shuffle.html">std::shuffle</a></div><div class="ttdeci">T shuffle(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d5/d91/namespacesorting_affc6ee160142cd017f8c4b213437d0fd_cgraph.svg" width="331" height="184"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d5/d91/namespacesorting_affc6ee160142cd017f8c4b213437d0fd_cgraph.svg" width="310" height="184"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
</div>

</div>
Expand Down Expand Up @@ -1226,13 +1230,13 @@ <h2 class="memtitle"><span class="permalink"><a href="#a7bfe11bd4703eacd1dab93f2
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>new array with elements shuffled from a given array </dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 36</span> {</div>
<div class="line"><span class="lineno"> 37</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; N; i++) {</div>
<div class="line"><span class="lineno"> 38</span> <span class="comment">// Swaps i&#39;th index with random index (less than array size)</span></div>
<div class="line"><span class="lineno"> 39</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(arr[i], arr[<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>() % N]);</div>
<div class="line"><span class="lineno"> 40</span> }</div>
<div class="line"><span class="lineno"> 41</span> <span class="keywordflow">return</span> arr;</div>
<div class="line"><span class="lineno"> 42</span>}</div>
<div class="fragment"><div class="line"><span class="lineno"> 37</span> {</div>
<div class="line"><span class="lineno"> 38</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; N; i++) {</div>
<div class="line"><span class="lineno"> 39</span> <span class="comment">// Swaps i&#39;th index with random index (less than array size)</span></div>
<div class="line"><span class="lineno"> 40</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/algorithm/swap.html">std::swap</a>(arr[i], arr[<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>() % N]);</div>
<div class="line"><span class="lineno"> 41</span> }</div>
<div class="line"><span class="lineno"> 42</span> <span class="keywordflow">return</span> arr;</div>
<div class="line"><span class="lineno"> 43</span>}</div>
<div class="ttc" id="arand_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a></div><div class="ttdeci">T rand(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<map id="sorting::randomized_bogosort" name="sorting::randomized_bogosort">
<area shape="rect" id="Node000001" title=" " alt="" coords="5,72,141,113"/>
<area shape="rect" id="Node000002" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/array/begin.html#" title=" " alt="" coords="199,5,314,31"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="119,69,188,40,202,34,203,39,190,45,121,74"/>
<area shape="rect" id="Node000003" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/array/end.html#" title=" " alt="" coords="204,55,310,80"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="141,81,188,74,189,80,142,86"/>
<area shape="rect" id="Node000004" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/is_sorted.html#" title=" " alt="" coords="207,104,307,130"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="142,99,192,106,191,111,141,104"/>
<area shape="rect" id="Node000005" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/random_shuffle.html#" title=" " alt="" coords="189,153,325,179"/>
<area shape="poly" id="edge4_Node000001_Node000005" title=" " alt="" coords="122,111,190,140,204,145,202,150,188,145,120,116"/>
<area shape="rect" id="Node000002" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/array/begin.html#" title=" " alt="" coords="189,5,304,31"/>
<area shape="poly" id="edge1_Node000001_Node000002" title=" " alt="" coords="120,70,188,40,198,35,200,40,190,45,122,74"/>
<area shape="rect" id="Node000003" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/container/array/end.html#" title=" " alt="" coords="194,55,299,80"/>
<area shape="poly" id="edge2_Node000001_Node000003" title=" " alt="" coords="141,80,178,75,178,80,142,86"/>
<area shape="rect" id="Node000004" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/is_sorted.html#" title=" " alt="" coords="196,104,296,130"/>
<area shape="poly" id="edge3_Node000001_Node000004" title=" " alt="" coords="142,100,181,105,180,110,141,105"/>
<area shape="rect" id="Node000005" href="/Users/runner/work/C-Plus-Plus/C-Plus-Plus/doc/cppreference-doxygen-web.tag.xml$cpp/algorithm/random_shuffle.html#" title=" " alt="" coords="203,153,290,179"/>
<area shape="poly" id="edge4_Node000001_Node000005" title=" " alt="" coords="124,111,190,140,200,144,198,149,188,145,122,116"/>
</map>
Original file line number Diff line number Diff line change
@@ -1 +1 @@
58a27e38eb26f58cbe89fb10eccd1f57
02a1f133375f430cea6cc95537f936be
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 20cd9a9

Please sign in to comment.