What is the complexity of the following algorithm in Big O:
for(int i = 2; i < n; i = i^i)
{
...do somthing
}
I'm not sure if there is a valid operator to this type of complexity. My initial thought was as follows:
After $k$ iterations we want: (using tetration?)
${^{k}i} = n \implies k=\log\log\log..._k\log{n}\implies\mathcal{O(\log\log\log..._k\log{n})}$ (where we have k times the log function) but i'm not sure if this is evan a valid way of writing this. Anyway, we have a complexity that that includes $k$, which does not seems right to me.
i^i
in the code is supposed to refer to exponentiation, and not bitwise XOR as would be suggested by the C-esque syntax? $\endgroup$ – Aaron Rotenberg Aug 26 '20 at 6:04i≈n
, isn't the answerO(RootOf(x**x==n))
? I am not sure if it has a closed-form solution. $\endgroup$ – DYZ Aug 26 '20 at 6:12