mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 05:42:59 +08:00
Documentation for c26eea874d
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="generator" content="Doxygen 1.13.2"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>TheAlgorithms/C++: bit_manipulation/set_kth_bit.cpp File Reference</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
@@ -60,7 +60,7 @@ window.MathJax = {
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.12.0 -->
|
||||
<!-- Generated by Doxygen 1.13.2 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -230,14 +230,12 @@ Functions</h2></td></tr>
|
||||
<div class="line"><span class="lineno"> 45</span> <span class="comment">// that no Overflow can be there.</span></div>
|
||||
<div class="line"><span class="lineno"> 46</span> </div>
|
||||
<div class="line"><span class="lineno"> 47</span> <span class="keywordtype">int</span> pos =</div>
|
||||
<div class="line"><span class="lineno"> 48</span> 1 << <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442">k</a>; <span class="comment">// "pos" variable is used to store 1 at kth postion and</span></div>
|
||||
<div class="line"><span class="lineno"> 48</span> 1 << k; <span class="comment">// "pos" variable is used to store 1 at kth postion and</span></div>
|
||||
<div class="line"><span class="lineno"> 49</span> <span class="comment">// rest bits are 0. in binary representation of number 'n'</span></div>
|
||||
<div class="line"><span class="lineno"> 50</span> </div>
|
||||
<div class="line"><span class="lineno"> 51</span> <span class="keywordflow">return</span> <a class="code hl_variable" href="../../d8/dab/sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> | pos; <span class="comment">// by taking or with the pos and the N we set the bit of N</span></div>
|
||||
<div class="line"><span class="lineno"> 51</span> <span class="keywordflow">return</span> N | pos; <span class="comment">// by taking or with the pos and the N we set the bit of N</span></div>
|
||||
<div class="line"><span class="lineno"> 52</span> <span class="comment">// at kth position.</span></div>
|
||||
<div class="line"><span class="lineno"> 53</span>}</div>
|
||||
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a1b74d828b33760094906797042b89442"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442">numerical_methods::simpson_method::k</a></div><div class="ttdeci">double k(double x)</div><div class="ttdoc">Another test function.</div><div class="ttdef"><b>Definition</b> <a href="../../d4/d18/composite__simpson__rule_8cpp_source.html#l00117">composite_simpson_rule.cpp:117</a></div></div>
|
||||
<div class="ttc" id="asparse__table_8cpp_html_a10f3ffb3f6f7e1b83d556b9c8de89a5d"><div class="ttname"><a href="../../d8/dab/sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a></div><div class="ttdeci">constexpr uint32_t N</div><div class="ttdoc">A struct to represent sparse table for min() as their invariant function, for the given array A....</div><div class="ttdef"><b>Definition</b> <a href="../../d8/dab/sparse__table_8cpp_source.html#l00048">sparse_table.cpp:48</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -259,7 +257,7 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
</td>
|
||||
<td class="mlabels-right">
|
||||
<span class="mlabels"><span class="mlabel">static</span></span> </td>
|
||||
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
@@ -270,16 +268,17 @@ Functions</h2></td></tr>
|
||||
<p class="definition">Definition at line <a class="el" href="../../d5/db5/set__kth__bit_8cpp_source.html#l00061">61</a> of file <a class="el" href="../../d5/db5/set__kth__bit_8cpp_source.html">set_kth_bit.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 61</span> {</div>
|
||||
<div class="line"><span class="lineno"> 62</span> <span class="comment">// n = 10,2 return 14</span></div>
|
||||
<div class="line"><span class="lineno"> 63</span> assert(bit_manipulation::set_kth_bit::setKthBit(10, 2) == 14);</div>
|
||||
<div class="line"><span class="lineno"> 63</span> assert(<a class="code hl_function" href="#ad4d0ffd9331242c42a28834ee19f5fd9">bit_manipulation::set_kth_bit::setKthBit</a>(10, 2) == 14);</div>
|
||||
<div class="line"><span class="lineno"> 64</span> <span class="comment">// n = 25,1 return 27</span></div>
|
||||
<div class="line"><span class="lineno"> 65</span> assert(bit_manipulation::set_kth_bit::setKthBit(25, 1) == 27);</div>
|
||||
<div class="line"><span class="lineno"> 65</span> assert(<a class="code hl_function" href="#ad4d0ffd9331242c42a28834ee19f5fd9">bit_manipulation::set_kth_bit::setKthBit</a>(25, 1) == 27);</div>
|
||||
<div class="line"><span class="lineno"> 66</span> <span class="comment">// n = 400001,5 return 400033</span></div>
|
||||
<div class="line"><span class="lineno"> 67</span> assert(bit_manipulation::set_kth_bit::setKthBit(400001, 5) == 400033);</div>
|
||||
<div class="line"><span class="lineno"> 67</span> assert(<a class="code hl_function" href="#ad4d0ffd9331242c42a28834ee19f5fd9">bit_manipulation::set_kth_bit::setKthBit</a>(400001, 5) == 400033);</div>
|
||||
<div class="line"><span class="lineno"> 68</span> <span class="comment">// n = 123 return 123</span></div>
|
||||
<div class="line"><span class="lineno"> 69</span> assert(bit_manipulation::set_kth_bit::setKthBit(123, 3) == 123);</div>
|
||||
<div class="line"><span class="lineno"> 69</span> assert(<a class="code hl_function" href="#ad4d0ffd9331242c42a28834ee19f5fd9">bit_manipulation::set_kth_bit::setKthBit</a>(123, 3) == 123);</div>
|
||||
<div class="line"><span class="lineno"> 70</span> </div>
|
||||
<div class="line"><span class="lineno"> 71</span> std::cout << <span class="stringliteral">"All test cases successfully passed!"</span> << std::endl;</div>
|
||||
<div class="line"><span class="lineno"> 72</span>}</div>
|
||||
<div class="ttc" id="aset__kth__bit_8cpp_html_ad4d0ffd9331242c42a28834ee19f5fd9"><div class="ttname"><a href="#ad4d0ffd9331242c42a28834ee19f5fd9">bit_manipulation::set_kth_bit::setKthBit</a></div><div class="ttdeci">std::uint64_t setKthBit(std ::int64_t N, std ::int64_t k)</div><div class="ttdoc">The main function implements set kth bit.</div><div class="ttdef"><b>Definition</b> <a href="../../d5/db5/set__kth__bit_8cpp_source.html#l00043">set_kth_bit.cpp:43</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -289,7 +288,7 @@ Functions</h2></td></tr>
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_f3c4fbc4e901afa0a54d0623c5574aa7.html">bit_manipulation</a></li><li class="navelem"><a class="el" href="../../d5/db5/set__kth__bit_8cpp.html">set_kth_bit.cpp</a></li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.12.0 </li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.13.2 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user