Documentation for c26eea874d

This commit is contained in:
realstealthninja
2025-05-19 11:38:33 +00:00
parent c7a9a42397
commit 14583a2f33
2829 changed files with 30266 additions and 21669 deletions

View File

@@ -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++: math/binary_exponent.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&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -152,8 +152,7 @@ Functions</h2></td></tr>
<div class="textblock"><p>C++ Program to find Binary Exponent Iteratively and Recursively. </p>
<p>Calculate \(a^b\) in \(O(\log(b))\) by converting \(b\) to a binary number. Binary exponentiation is also known as exponentiation by squaring. </p><dl class="section note"><dt>Note</dt><dd>This is a far better approach compared to naive method which provide \(O(b)\) operations.</dd></dl>
<p>Example: 10 in base 2 is 1010. </p><p class="formulaDsp">
\begin{eqnarray*}
2^{10_d} &amp;=&amp; 2^{1010_b} = 2^8 * 2^2\\
\begin{eqnarray*}2^{10_d} &amp;=&amp; 2^{1010_b} = 2^8 * 2^2\\
2^1 &amp;=&amp; 2\\
2^2 &amp;=&amp; (2^1)^2 = 2^2 = 4\\
2^4 &amp;=&amp; (2^2)^2 = 4^2 = 16\\
@@ -266,7 +265,7 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 62</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Exponent must be positive !!&quot;</span> &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 63</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><span class="lineno"> 64</span> <span class="keywordtype">int</span> resRecurse = <a class="code hl_function" href="#aeb48dce0725e63d19147944f41843c73">binExpo</a>(a, b);</div>
<div class="line"><span class="lineno"> 66</span> </div>
<div class="line"><span class="lineno"> 66</span></div>
<div class="line"><span class="lineno"> 68</span> std::cout &lt;&lt; resRecurse &lt;&lt; std::endl;</div>
<div class="line"><span class="lineno"> 70</span> }</div>
<div class="line"><span class="lineno"> 71</span>}</div>
@@ -279,7 +278,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_296d53ceaeaa7e099814a6def439fe8a.html">math</a></li><li class="navelem"><a class="el" href="../../de/dcf/binary__exponent_8cpp.html">binary_exponent.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>