If Big oh represents the worst case, why is it being used to represent average and best case of an algorithm
like quick sort time complexity
average is O(nlogn)
best is O(nlogn)
instead of Omega(nlogn)
worst is O(n^2)

- 21,482
- 2
- 51
- 63

- 19
- 2
2 Answers
Big-O does not represent the worst case (of an algorithm); rather, it represents an (asymptotic) upper bound (on a function). It's perfectly valid, and often useful, to discuss an upper bound on the best-case or average-case performance of an algorithm. One algorithm may perform better than another in practice, even if they both have the same worst-case performance, if one of them has better average-case performance.

- 175,680
- 26
- 273
- 307
Big O tells that the complexity will be upper bound by a particular function.
So when we try to explain the average and best case using Big O, we are effectively saying that the average case is upper bound by that function.
In other words, the average case and best case representation, when expressed using Big O, mean that for a large enough value of n, the average and best cases will not perform worse than that function.

- 13,888
- 8
- 60
- 75