2 ms·
It's still O(n) or O(log(n)) as you have to compute the value using exponentiation to the nth power. Which offers either a linear algorithm or a faster logarith
by Jtsummers 5y ago
It's still O(n) or O(log(n)) as you have to compute the value using exponentiation to the nth power. Which offers either a linear algorithm or a faster logarithmic algorithm if you use fast exponentiation. It isn't actually O(1).