–1 votes –1 votes What will be the time complexity of a function f(n) = n^-2 i.e. pow (n,-2) ? Algorithms time-complexity algorithms asymptotic-notation + – dragonball asked Sep 12, 2017 dragonball 501 views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply vivek9837 commented Sep 12, 2017 reply Follow Share O(1) ? 2 votes 2 votes dragonball commented Sep 12, 2017 reply Follow Share How ?? 0 votes 0 votes vivek9837 commented Sep 12, 2017 reply Follow Share 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. 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes f(n) = n-2 = 1/n2= 1/(nxn) ie f(n) = 1/(nxn) this can be done in 0(1). Satyajeet Singh answered Sep 12, 2017 Satyajeet Singh comment Share Follow See all 2 Comments See all 2 2 Comments reply dragonball commented Sep 12, 2017 reply Follow Share 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. 0 votes 0 votes Surajit commented Sep 21, 2017 reply Follow Share 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). 0 votes 0 votes Please log in or register to add a comment.