Add explanation for the Binary Exponentiation

This commit is contained in:
Rahul Jain
2020-10-29 21:42:10 +05:30
parent ae3bd72ca8
commit c7fe697ca4

View File

@ -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