time complexity - Big O Notation of an expression -


if have algorithm takes 4n^2 + 7n moves accomplish, o? o(4n^2)? o(n^2)?

i know 7n cut off, don't know if should keep n^2 coefficient or not.

thanks

you should drop coefficients because question asking "on order of", tries characterize linear, exponential, logarithmic, etc... is, when n large, coefficient of little importance.

this explains why drop +7n, because when n large, term has relatively little significance final answer. if familiar calculus, might lim n->inf(4*n^2+7n) ~= lim n->inf(4*n^2) ~= lim n->inf(n^2)

you can think in graphical sense... is, if graph function 4n^2 + 7n larger , larger values of n, mathematician might "it looks n^2". granted, have liberal mathematician, isn't rigorous statement, that's o(...) trying convey.


Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -