1. Optimized Power Function #
Created Saturday 01 August 2020
- Naive solution: for loop, O(n)
- But the solution is symmetric, so their’s heterogeneous repetition of work.
- But we can work in squares(symmetry is minimum of 2).
x^8^ = ((x^2^)^2^)^2^ 3 multiplications, instead of 8 x^9^ = x*x^8^ 4 multiplications