
Some functions may have negative complexity and I’m worried for my crypto - LightMachine
https://medium.com/@maiavictor/some-functions-may-have-negative-complexity-im-worried-for-my-crypto-c53f6e7343d3
======
gus_massa
Is this just a very smart optimizer that can reduce

    
    
      tot=x+x+x+x+x+x+x+x+x+x+x+x+x+x+x
    

to

    
    
      x2=x+x
      x4=x2+x2
      x8=x4+x4
      tot=x+x2+x4+x8
    

or I am missing something?

Note that the first code is O(N=15) and the second one is O(log(N)=4).

