What is the difference between lower bound and tight bound?

后端 未结 8 803
遇见更好的自我
遇见更好的自我 2020-12-04 04:56

With the reference of this answer, what is Theta (tight bound)?

Omega is lower bound, quite understood, the minimum time an algorithm may take. And we know Big-O is

相关标签:
8条回答
  • 2020-12-04 05:28

    If I were lazy, I could say that binary search on a sorted array is O(n2), O(n3), and O(2n), and I would be technically correct in every case.

    We can use o-notation ("little-oh") to denote an upper bound that is not asymptotically tight. Both big-oh and little-oh are similar. But, big-oh is likely used to define asymptotically tight upper bound.

    0 讨论(0)
  • 2020-12-04 05:34

    Precisely the lower bound or $\omega $ bfon f(n) means the set of functions which are asymptotically less or equal to f(n) i.e U g(n)≤ cf(n) $\for all $`un≥ n' For some c, n' $\in $ $\Bbb{N}$

    And the upper bound or $\mathit{O}$ on f(n) means the set of functions which are assymptotically greater or equal to f(n) which mathematically tells,

    $ g(n)\ge cf(n) \for all n\ge n' $ , for some c,n' $\in $ $\Bbb{N}$.

    Now the $\Theta $ is the intersection of the above written two

    $\theta $

    Like if a algorithm is like " exactly $\Omega\left( f(n)\ right$ " then it's better to say it's $\Theta\left(f(n)\right)$ .

    Or , we can say also that it give us the actual speed where $ \omega $ gives us the lowest limit.

    0 讨论(0)
  • 2020-12-04 05:36

    Θ-notation (theta notation) is called tight-bound because it's more precise than O-notation and Ω-notation (omega notation).

    If I were lazy, I could say that binary search on a sorted array is O(n2), O(n3), and O(2n), and I would be technically correct in every case. That's because O-notation only specifies an upper bound, and binary search is bounded on the high side by all of those functions, just not very closely. These lazy estimates would be useless.

    Θ-notation solves this problem by combining O-notation and Ω-notation. If I say that binary search is Θ(log n), that gives you more precise information. It tells you that the algorithm is bounded on both sides by the given function, so it will never be significantly faster or slower than stated.

    0 讨论(0)
  • 2020-12-04 05:38

    Big O is the upper bound, while Omega is the lower bound. Theta requires both Big O and Omega, so that's why it's referred to as a tight bound (it must be both the upper and lower bound).

    For example, an algorithm taking Omega(n log n) takes at least n log n time, but has no upper limit. An algorithm taking Theta(n log n) is far preferential since it takes at least n log n (Omega n log n) and no more than n log n (Big O n log n).

    0 讨论(0)
  • 2020-12-04 05:38

    The phrases minimum time and maximum time are a bit misleading here. When we talk about big O notations, it's not the actual time we are interested in, it is how the time increases when our input size gets bigger. And it's usually the average or worst case time we are talking about, not best case, which usually is not meaningful in solving our problems.

    Using the array search in the accepted answer to the other question as an example. The time it takes to find a particular number in list of size n is n/2 * some_constant in average. If you treat it as a function f(n) = n/2*some_constant, it increases no faster than g(n) = n, in the sense as given by Charlie. Also, it increases no slower than g(n) either. Hence, g(n) is actually both an upper bound and a lower bound of f(n) in Big-O notation, so the complexity of linear search is exactly n, meaning that it is Theta(n).

    In this regard, the explanation in the accepted answer to the other question is not entirely correct, which claims that O(n) is upper bound because the algorithm can run in constant time for some inputs (this is the best case I mentioned above, which is not really what we want to know about the running time).

    0 讨论(0)
  • 2020-12-04 05:47

    The basic difference between

    Blockquote

    asymptotically upper bound and asymptotically tight Asym.upperbound means a given algorythm that can executes with maximum amount of time depending upon the number of inputs ,for eg in sorting algo if all the array (n)elements are in descending order then for ascending them it will take a running time of O(n) which shows upper bound complexity ,but if they are already sorted then it will take ohm(1).so we generally used "O"notation for upper bound complexity.

    Asym. tightbound bound shows the for eg(c1g(n)<=f(n)<=c2g(n)) shows the tight bound limit such that the function have the value in between two bound (upper bound and lower bound),giving the average case.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题