Big-Omega & Big-Theta
Big-Oh Gives Upper Bounds
For f,g functions N→R+,
f(n)=Ω(g(n)) means there are c,n0>0 s.t.
∀n>n0f(n)≥c×g(n)
i.e. f is asymptotically bounded from below by g
(A graph with two lines.
f is a blue line with a wobbly, but mostly linear movement upwards.
c times g is a red line which has a similar trajectory, but end up just slightly below the blue line.)
Note: We may have C<<1
or f grows asymptotically at least as fast as g.
Big-Oh & Big-Omega are Duals
Fact: f(n)=Ω(g(n))↔g(n)=O(f(n))
Pf: f(n)=Ω(g(n)):
-
⟺∃n0,c′>0 s.t. n>n0⟹f(n)≥c′⋅g(n)
-
⟺∃n0,c′>0 s.t. n>n0⟹c′⋅g(n)≤f(n)
- ⟺∃n0,c>0 s.t. n>n0⟹g(n)≤c⋅f(n) // letting c=c′1
-
⟺g(n)O(f(n))
So: f grows at least as fast as g ⟺ g grows at most as fast as f.
Examples: Worse-case times
Operation |
O(1) |
Ω(1) |
O(logn) (highlighted) |
Ω(logn) (highlighted) |
O(n) |
Ω(n) |
O(nlogn) |
Ω(nlogn) |
stack push/pop (highlighted) |
✓ (green) |
✓ (green) |
✓ |
❌ (blue) |
✓ |
❌ (blue) |
✓ |
❌ (blue) |
unqueue/dequeue |
✓ (green) |
✓ (green) |
✓ |
❌ (blue) |
✓ |
❌ (blue) |
✓ |
❌ (blue) |
heap insert or extract min |
❌ (pink) |
✓ |
✓ (green) |
✓ (green) |
✓ |
❌ (blue) |
✓ |
❌ (blue) |
AVL-tree find, insert, remove |
❌ (pink) |
✓ |
✓ (green) |
✓ (green) |
✓ |
❌ (blue) |
✓ |
❌ (blue) |
make_heap |
❌ (pink) |
✓ |
❌ (pink) |
✓ |
✓ (green) |
✓ (green) |
✓ |
❌ (blue) |
BST find, insert, remove |
❌ (pink) |
✓ |
❌ (pink) |
✓ |
✓ (green) |
✓ (green) |
✓ |
❌ (blue) |
Sorting |
❌ (pink) |
✓ |
❌ (pink) |
✓ |
❌ (pink) |
✓ (green) |
✓ (green) |
? (red) |
Big-Theta Expresses “Tight Bounds”
For f,g functions N→R+,
f(n)=Θ(g(n)) means there are c1,c2,n0>0 s.t. n>n0⟹c1⋅g(n)≤f(n)≤c2⋅g(n)
i.e. f asymptotically bounded from above and below by g
(Diagram with three lines, wobbly but roughly linear, with them stacked in the following order from top to bottom:
-
c2⋅g
- f
- c1⋅g)
or f grows asymptotically the same as g.
“Grows the same as” is systemetic
Fact: f(n)=Θ(g(n))⟺g(n)=Θ(f(n))
i.e. f grows the same as g ⟺ g grows the same as f.
P.f.: $$f(n) = \Theta(g(n))
-
⟺∃c1,c2,n0>0 s.t. ∀n>n0c1⋅g(n)≤f(n)≤c2⋅g(n)
-
⟺∃c1,c2,n0>0 s.t. ∀n>n0c21f(n)≤g(n)≤c11f(n)
-
⟺∃c3,c4,n0>0 s.t. ∀n>n0c3f(n)≤g(n)≤c4f(n)
-
⟺g(n)=Θ(f(n))
End