Update math/binary_exponent.cpp

Co-Authored-By: John Law <johnlaw.po@gmail.com>
This commit is contained in:
Mann Mehta
2020-04-04 17:28:19 +05:30
committed by GitHub
parent 085c6943a0
commit bcb3677f78

View File

@@ -2,7 +2,7 @@
#include<iostream>
/*
* Calculating a^b in O(log(b)) by converting b in binary no.
* Calculate a^b in O(log(b)) by converting b to a binary number
* Binary exponentiation (also known as exponentiation by squaring)
* is a trick which allows to calculate an using only O(logn) multiplications
* (instead of O(n) multiplications required by the naive approach).