We now have some very powerful analysis tools at our disposal. We can use Big O to determine broadly how efficient an algorithm is, and we can also compare two algorithms that fall within one classification of Big O.
However, there is another important factor to take into account when comparing the efficiencies of two algorithms. Until now, we’ve focused on how slow an algorithm is in a worst-case scenario. Now, worst-case scenarios, by definition, don’t happen all the time. On average, the scenarios that occur are—well—average-case scenarios. In the next chapter, we’ll learn how to take all scenarios into account.