00:01
So we're asked to determine the complexity of the algorithm for fast modular exponentiation.
00:09
So this is the algorithm.
00:11
So first you have x equals 1, then you have power equals b mod m.
00:19
Then for each iteration from 0 to k minus 1, if ai equals 1, where ai is each digit in the binary representation of the number, then x equals x times power, mod m and power equals power times power mod m and then you returned likes the last x computation which is x equals b to the n mod m so let's analyze the complexity this algorithm so first you have x equals one power equals b mod m these are all just single operations so the complexity isn't really affected by these two things these two lines here but then in this form loop we have for ion range 0 to k minus 1.
01:33
It says if ai equals 1, then you do these operations.
01:38
So in the worst case, ai is going to be equal to 1 for every single digit inside your binary representation.
01:45
So for example, 1, 1, 1, 1, like this...