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:

  1. n log n = o(n^2) true - false?
  2. 2n – 3 = Θ(n) true - false?
  3. n^2 + 3 = Ω(n^3) true - false?
  4. 2n log n – 3n = o(n) true - false?
  5. 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

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -