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

后端 未结 9 1073

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:47

    There's a simple way (a trick, I guess) to remember which notation means what.

    All of the Big-O notations can be considered to have a bar.

    When looking at a Ω, the bar is at the bottom, so it is an (asymptotic) lower bound.

    When looking at a Θ, the bar is obviously in the middle. So it is an (asymptotic) tight bound.

    When handwriting O, you usually finish at the top, and draw a squiggle. Therefore O(n) is the upper bound of the function. To be fair, this one doesn't work with most fonts, but it is the original justification of the names.

提交回复
热议问题