python - What is the Big-O performance of this algorithm and how do I solve this normally? -
hello have algorithm having trouble finding performance.
i=math.ceil(n**0.5) while n % != 0: -= 2
would o(2^n)?
i don't know trying do, current code run give error cannot divide zero many cases example n=13
, if i-=1
in place of i-=2
code work fine without error every n
, complexity o(n^(1\2))
.