which is best algorithm?

Posted by Lopa on Stack Overflow See other posts from Stack Overflow or by Lopa
Published on 2010-03-23T17:11:19Z Indexed on 2010/03/23 17:13 UTC
Read the original article Hit count: 479

Filed under:

Consider two algorithms A and B which solve the same problem, and have time complexities (in terms of the number of elementary operations they perform) given respectively by

a(n) = 9n+6

b(n) = 2(n^2)+1

(i) Which algorithm is the best asymptotically?

(ii) Which is the best for small input sizes n, and for what values of n is this the case? (You may assume where necessary that n>0.)

i think its 9n+6. guys could you please help me with whether its right or wrong?? and whats the answer for part b. what exactly do they want?

© Stack Overflow or respective owner

Related posts about algorithm