Algorithm efficiency metrics
It is important to understand how well your algorithm is going to perform. To understand this vital statistic, Big O and Big Omega (Big Ω) metrics are used. This section is going to be dedicated to exploring and understanding these metrics at a high level. Therefore, let’s start our discussion with Big O!
Exploring the Big O notation
The most common efficiency metric for a sorting algorithm is the Big O notation. The Big O notation, or simply Big O, represents the upper bound of an algorithm’s time complexity. In other words, in terms of sorting, you can think of Big O as the worst-case execution time for an algorithm. In terms of software development, you want as small a Big O value as possible. The following are some common Big O time complexities:
- Constant time complexity: Represented as
O(1)
, this is the most ideal time complexity. With this Big O time complexity, that worst-case runtime will never change, regardless...