The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
–1 vote
92 views
What will be the time complexity of a function f(n) = n^-2  i.e. pow (n,-2) ?
asked in Algorithms by Active (1.3k points) | 92 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 Active (1.1k 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).


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

28,834 questions
36,686 answers
90,617 comments
34,640 users