Time complexity of algorithms -
i have question time complexity. don't understand how if it's true or false. can tell me how find result? explain total newbie please.
here examples:
n log n = o(n^2)
true - false?2n – 3 = Θ(n)
true - false?n^2 + 3 = Ω(n^3)
true - false?2n log n – 3n = o(n)
true - false?n^2 + 5n – 6 = Θ(n^2)
true - false?
first of all, should know different symbols mean. that, take @ here: asymptotic notation on wolframalpha
there various way study , determine if these true or false, (and question "do homework please" one), in general need determine happens "for arbitrarily large n
"
as quick , dirty way (not mathematically correct enough determining complexity simple algorithms), can ignore additive constants (e.g. -2
, +1
, ...) , evaluate what's left 2 "big" n (like 1e9 , 1e13) , check ratio. if stays same 2 complexities asymptotically "the same", if not 1 asymptotically dominates other (= grows faster, means large n
can ignore other)
for correct , complete mathematical approach, calculus courses treat argument, can surely find resources online, e.g. here: growth of functions
Comments
Post a Comment