GATE CSE
First time here? Checkout the FAQ!
x
–1 vote
72 views
What will be the time complexity of a function f(n) = n^-2  i.e. pow (n,-2) ?
asked in Algorithms by Junior (601 points)   | 72 views
O(1) ?
How ??
because for $\frac{1}{n^{2}}$ as n grows from 1 onwards, it monotonically decreases and can never exceed a positive constant greater than 1.

1 Answer

+1 vote

f(n) = n-2 = 1/n2= 1/(nxn)  ie f(n) = 1/(nxn)

this can be done in 0(1).

answered by Junior (775 points)  
This is not polynomial function and not in the form of n^k where k is some constant . How we could find the complexity ? Plz elaborate it.
hey...what not use definite integral of function f(n) = 1/n^2 ??.That's a easy way to estimate areas under a function curve..I am getting constant after integrating it..So looks like O(1).


Top Users Sep 2017
  1. Habibkhan

    7194 Points

  2. Warrior

    2686 Points

  3. Arjun

    2594 Points

  4. rishu_darkshadow

    2568 Points

  5. A_i_$_h

    2280 Points

  6. nikunj

    1980 Points

  7. manu00x

    1856 Points

  8. makhdoom ghaya

    1770 Points

  9. Bikram

    1744 Points

  10. SiddharthMahapatra

    1718 Points


26,164 questions
33,743 answers
79,992 comments
31,123 users