-1

Is it correct?

1/(1+2+.....+sqrtN) =1/((N+sqrtN)/2)=2/(N+sqrtN)=1/N =O(1/N) =O(1)

Or is it equal to O(N), if so then what does N in O(1/N) refers. Is N here deals with very large operations if so then sum of sqrtN operations must also equal to N and hence result into O(1).

I'd be happy to know where am I getting wrong about big O ratio.

sync11
  • 1,056
  • 2
  • 9
  • 21
  • Possible duplicate of [What is a plain English explanation of "Big O" notation?](http://stackoverflow.com/questions/487258/what-is-a-plain-english-explanation-of-big-o-notation) – xenteros Aug 10 '16 at 14:00
  • Possible duplicate of (http://stackoverflow.com/questions/905551/are-there-any-o1-n-algorithms) – xenteros Aug 10 '16 at 14:03
  • 2
    wait what? these summation is meant to evaluate some real life machine code operations ? none of the statement make mathematical sense either – Yerken Aug 10 '16 at 14:10
  • @yerken, can you mark your answer regarding the series – sync11 Aug 10 '16 at 14:17

1 Answers1

1

Yes.

O(1/N) <= O(1)

An algorithm to be O(1/N) means that it executes asymptotically in less steps than the algorithm consisting of a single instruction. If it executes in less steps than one step for all N > N0, it must consist of precisely no instruction at all for those n. Since checking 'if N > N0' costs at least 1 instruction, it must consist of no instruction for all N.

Summing up: The only algorithm which is O(1/N) is the empty algorithm, consisting of no instruction.

Shravan40
  • 6,849
  • 5
  • 21
  • 43
  • well thank you for your advice regarding empty function. but what shall be the complexity of given function 1/(1+2+...+sqrtN). is it O(N)? do explain – sync11 Aug 10 '16 at 14:04
  • It's programming community - not mathematical. You can visit [math.se] for functional analysis. On [so] we might consider analyzing growing functions. The rest of functions is actually out of our interests. – xenteros Aug 11 '16 at 06:38