in Algorithms edited by
17,325 views
67 votes
67 votes

Let $f(n) = n$ and $g(n) = n^{(1 + \sin \: n)}$, where $n$ is a positive integer. Which of the following statements is/are correct?

  1. $f(n) = O(g(n))$
  2. $f(n) = \Omega(g(n))$
  1. Only I
  2. Only II
  3. Both I and II
  4. Neither I nor II
in Algorithms edited by
17.3k views

4 Comments

even for positive values of n, Sin n can be negative
4
4

if instead g(n)=n^(1+sin n)  ,we have g(n)=n^(2+sin n) then sin n max value 1 (g(n)=n^2) and min value -1 (g(n)=n

so option 1 would be correct.

0
0

here, use of the sentence "where n is a positive number" is about n being equal to 0, 45, 60, 90, 180,  270, 360 (not negative -45, -90  etc.,)

here sinn (sin0, sin45, sin60, sin180 ) equals -1 to 1 

note: sinn value can be positive or negative, n should be positive number is what meant 

0
0

11 Answers

86 votes
86 votes
Best answer

The answer is option (D).

Since the value of $\sin(n)$ will always range from $-1$ to $+1$, hence $g(n)$ can take values $1$, $n$, $n^2$.

Hence, if $g(n) = 1$, then statement I is incorrect.

And, if $g(n) = n^2$, then statement II is incorrect.

edited by

4 Comments

Thank u very much sir
4
4
This example is given in CLRS 3rd Ed. PN 52. The book clearly says (and explains) that these two functions are not comparable asymptotically. Those still in doubt can refer the book to understand.
16
16

Since the value of sin(n) will always range from −1 to +1, hence g(n) can take values 1,n,n2 .

Hence, if g(n)=1, Statement I is incorrect,But at same time statement 2 is correct.

And, if g(n)=n2, then Statement II is incorrect,and here also statement 1 is correct.

So option c or d,please explain.

0
0
15 votes
15 votes

This exact example is given in CLRS 3rd Ed. PN 52, It clearly states that we can't compare these two  fn using asymptotic notation so answer is option D

2 Comments

Thanks you
1
1
True,

if g(n)=$n^{(1+|sin(n)|)}$ ans would be f(n)=O(g(n)) right?
1
1
10 votes
10 votes
actually sinn oscillates between -1 and 1.

So, g(n) has a range of values between 1 and n^2 i.e. g(n) = [1, n^2].

But we can't really compare f(n) and g(n) for large values of n.

So, (D) is correct without a shadow of doubt.

1 comment

thnx
0
0
8 votes
8 votes
n f(n) g(n)
90 (90)^2 90
180 180 180
270 1 270
360 360 360

Here we can put different values of n ranging from 90 ,180 ,270 and 360 sometimes value of f(n) increases and sometimes g(n) ,so we cant say which one is greater or lesser.

Sine curve graph

Image result for sine curve graph

OPTION D IS CORRECT

2 Comments

So if some function is lower-bound and upper-bound at same time for another function then we can't compare both of them, right?
1
1
Yup True.
1
1
Answer:

Related questions