Efficiency and Big-O Notation

With every new data structure and algorithm that we have learned, we have also discussed the efficiency implications. We will continue to do so in this course, and will also learn new ways of evaluating the efficiency of algorithms in terms of time and space.

We have been using big-O notation to describe efficiency. To remind yourself of the basics of big-O notation, watch the video below:

To summarize:

  • Big-O notation is a measure of an algorithms efficiency
  • It describes the efficiency as a function of the size of the input, n
  • When given an expression that represents the number of operations of an algorithm, the corresponding big-O notation can be calculated by ignoring lower-order terms and constants
  • Other heuristics can be used to derive big-O expressions, such as by analyzing loops
  • It's important to remember that big-O notation is a simplified way of describing efficiency that focuses on the worst-case behavior of an algorithm; in practice, we care about all cases