1 votes 1 votes 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 Algorithms algorithms asymptotic-notation + – sh!va asked Oct 29, 2016 sh!va 1.0k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply Digvijaysingh Gautam commented Oct 29, 2016 reply Follow Share Answer should be D) 1 votes 1 votes mcjoshi commented Oct 29, 2016 reply Follow Share yes both $n$ and $n^2$ are upper bounds. 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes 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) kirti singh answered Oct 29, 2016 • edited Oct 29, 2016 by kirti singh kirti singh comment Share Follow See all 2 Comments See all 2 2 Comments reply mohit chawla commented Oct 29, 2016 reply Follow Share 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 votes 0 votes kirti singh commented Oct 29, 2016 reply Follow Share yep.. got ur point.. i was actually thinking in other way.. C also should be correct.. 0 votes 0 votes Please log in or register to add a comment.
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. mohit chawla answered Oct 29, 2016 mohit chawla comment Share Follow See all 0 reply Please log in or register to add a comment.