Documentation for 2a076c1b03

This commit is contained in:
github-actions
2022-06-09 15:19:34 +00:00
parent 44595908ec
commit a0e8991686
4173 changed files with 15438 additions and 15542 deletions

View File

@@ -3,7 +3,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.9.3"/>
<meta name="generator" content="Doxygen 1.9.4"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: math/binary_exponent.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.3 -->
<!-- Generated by Doxygen 1.9.4 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search",'Search','.html');
@@ -120,7 +120,13 @@ 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\\ 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\\ 2^8 &amp;=&amp; (2^4)^2 = 16^2 = 256\\ \end{eqnarray*}
\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\\
2^8 &amp;=&amp; (2^4)^2 = 16^2 = 256\\
\end{eqnarray*}
</p>
<p> Hence to calculate 2^10 we only need to multiply \(2^8\) and \(2^2\) skipping \(2^1\) and \(2^4\). </p>
</div><h2 class="groupheader">Function Documentation</h2>
@@ -267,7 +273,7 @@ Here is the call graph for this function:</div>
<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.9.3 </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.9.4 </li>
</ul>
</div>
</body>