CST370 Week 2
July 5, 2025
So this week we explored how an algorithm’s run-time changes as the input size n grows. Big O is the worst case scenario for example, searching an array when a key value is only at the very last index or not even in the array Omega is the best case scenario for example, when a key value is the very first element. Theta gives the tight middle ground, it can describe something as simple as a loop that prints every element in an array. In that task the loop always performs one basic operation per element, no matter how the data look
This is Big O:
0 <= f(n) <= Cg(n) for all n >= n0
Theta:
0 <= C2g(n) <= f(n) <= C1g(n) for n >= n0
Big Omega:
0 <= Cg(n) <= f(n) for all n >= n0
Comments
Post a Comment