in Algorithms
982 views
1 vote
1 vote

Find the upper bound of given function:

f(n) =n

a) O(1)

b) O( n)

c) O(n 2)

d)  Both b and c

in Algorithms
by
982 views

2 Comments

Answer should be D)
1
1
yes both $n$ and $n^2$ are upper bounds.
0
0

2 Answers

1 vote
1 vote
because here all option is given in terms of big O.. and  if worst case is O (n).. den why it would be more worst.. m actually not sure.. but I think it should be B..

EDIT: since n <n^2... it also can be f (n) =O (n^2)
edited by

2 Comments

your point is good, but i think , but C option can be correct too as Big Oh means '<='  i.e f(n) = O(g(n)) means f(n) <= g(n) so here anything above n, would satisfy the condition. therefor C is also a correct answer with b.
therefore D should be the correct answer.
0
0
yep.. got ur point.. i was actually thinking in other way.. C also should be correct..
0
0
0 votes
0 votes
As questions is only asking for upper bound, not tight upper bound, so option b, c both suffice. therefor option D should be correct.
Answer: