big o - What is constant factors and low-order term in algorithms? -
in following video described asymptotic analyzes issues: https://class.coursera.org/algo-004/lecture/169
but can't understand "low-order term" , "constant factor" itself? (it @ 4th minute of video).
the merge sort 6n*log2(n)+6n
. why 6n
low-order term in case mentioned in video , 6 constant factor
? these terms have concrete definition?
lower-order term:
"order" here refers order of magnitude.
the concept easy understand , explain when dealing simple terms such x
or x2
. x
has order of magnitude 1
, since can written x1
, , x2
has order 2 - order of magnitude equal power of variable in term. things little more hazy (at least me) when complicate things by, example, adding log
. [1]
in informal terms, f(x)
lower order g(x)
if f(x) < g(x)
x
tends infinity.
it's easy see f(n) = 6n
lower order g(n) = 6n*log2(n)
substituting large value n
(the correct approach mathematically prove it, substituting large value tends work simple terms).
the terms things separated plus / minus symbols.
so lower-order term term of lower order other term.
presumably opposite of the leading-order term, term largest order of magnitude.
[1]: deal big-o lot, it's been while (high-school?) since i've dealt basics of order of magnitude, apologies if might have missed or forgotten regarding part.
constant factor:
"factor" term in multiplication. 6n
, 6
, n
factors.
a constant factor doesn't depend on input parameter(s) (which n
in case).
here, regardless of make n
, 6
stay 6
, it's constant.
Comments
Post a Comment