What is the difference between Θ(n) and O(n)?

后端 未结 9 1168

Sometimes I see Θ(n) with the strange Θ symbol with something in the middle of it, and sometimes just O(n). Is it just laziness of typing because nobody knows how to type th

9条回答
  •  温柔的废话
    2020-11-22 04:57

    Theta is a shorthand way of referring to a special situtation where the big O and Omega are the same.

    Thus, if one claims The Theta is expression q, then they are also necessarily claiming that Big O is expression q and Omega is expression q.


    Rough analogy:

    If: Theta claims, "That animal has 5 legs." then it follows that: Big O is true ("That animal has less than or equal to 5 legs.") and Omega is true("That animal has more than or equal to 5 legs.")

    It's only a rough analogy because the expressions aren't necessarily specific numbers, but instead functions of varying orders of magnitude such as log(n), n, n^2, (etc.).

提交回复
热议问题