4 Big-O notation: A framework for measuring algorithm efficiency

In this chapter

  • objectively comparing different algorithms
  • using big-O notation to understand data structures
  • the difference between worst-case, average, and amortized analysis
  • a comparative analysis of binary and linear search

In chapter 3, we discussed how binary search seems faster than linear search, but we didn’t have the tools to explain why. In this chapter, we introduce an analysis technique that will change the way you work—and that’s an understatement. After reading this chapter, you’ll be able to distinguish between the high-level analysis of the performance of algorithms and data structures and the more concrete analysis of your code’s running time. This will help ...

Get Grokking Data Structures now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.