mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Update math/binary_exponent.cpp
Co-Authored-By: John Law <johnlaw.po@gmail.com>
This commit is contained in:
parent
085c6943a0
commit
bcb3677f78
@ -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).
|
||||
|
Loading…
Reference in New Issue
Block a user