mirror of
https://github.com/TheAlgorithms/JavaScript.git
synced 2025-07-04 15:39:42 +08:00
Add explanation for the Binary Exponentiation
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
// To calculate x^n i.e. exponent(x, n) in O(log n) time in iterative way
|
||||
// n is an integer and n >= 0
|
||||
|
||||
// Explanation: https://en.wikipedia.org/wiki/Exponentiation_by_squaring
|
||||
|
||||
// Examples:
|
||||
// 2^3 = 8
|
||||
// 5^0 = 1
|
||||
|
Reference in New Issue
Block a user