mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Added comments
This commit is contained in:
parent
c7a50927b7
commit
55ff267e5e
@ -1,4 +1,4 @@
|
|||||||
/// C++ Program to find Binary Exponent recursively.
|
///C++ Program to find Binary Exponent recursively.
|
||||||
|
|
||||||
#include<iostream>
|
#include<iostream>
|
||||||
/*
|
/*
|
||||||
@ -8,6 +8,7 @@
|
|||||||
* (instead of O(n) multiplications required by the naive approach).
|
* (instead of O(n) multiplications required by the naive approach).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
///Function to calculate exponent in O(log(n)) using binary exponent.
|
||||||
int binExpo(int a,int b) {
|
int binExpo(int a,int b) {
|
||||||
if (b == 0) return 1;
|
if (b == 0) return 1;
|
||||||
int res = binExpo(a,b/2);
|
int res = binExpo(a,b/2);
|
||||||
|
Loading…
Reference in New Issue
Block a user