written 8.7 years ago by
teamques10
★ 69k
|
•
modified 8.3 years ago
|
θ- Notation (Figure 3 (a)):
- The theta notation bounds a function from above and below, so it defines exact asymptotic behavior.
- A simple way to get Theta notation of an expression is to drop low order terms and ignore leading constants.
- For example, consider the following expression.
3n3+6n2+6000=θ(n3)
- Formal definition:
Let f and g be two functions defined on some subset of the real numbers then
f(n) = θ (g(n)) as n→ infinity
If there are exist positive constants ‘no’ and ‘c1’ and ‘c2’such that to the right of ‘no’, the value of f (n) always lies between c1g(n) and c2g(n) inclusive.
O- Notation (Figure 3 (b)):
- The Big O notation defines an upper bound of an algorithm.
- It bounds a function only from above.
- For example, consider the case of Insertion Sort. It takes linear time in best case and quadratic time in worst case.
- The time complexity of Insertion sort is O(n2). Note that O(n2) also covers linear time.
- Formal definition:
Let f and g be two functions defined on some subset of the real numbers then
f(n) = O (g(n)) as n→ infinity
If there are positive constants ‘no’ and ‘c’ such that to the right of ‘no’, the value of
f (n)always lies on or below cg(n).
Ω-Notation (Figure 3 (c)):
- The Omega notation defines a lower bound of an algorithm.
- It bounds a function only from below.
- For example, consider the case of Insertion Sort. The time complexity of Insertion sort is Ω (n).
- But it is not very useful information about insertion sort, as we use worst case and sometimes in average case.
- Formal definition:
Let f and g be two functions defined on some subset of the real numbers then
f(n) = Ω(g(n)) as n→ infinity
If there are positive constants ‘no’ and ‘c’ such that to the right of ‘no’, the value of
f (n)always lies on or above cg(n).
