Chapter 1. Introduction to Algorithms

In this chapter

  • You get a foundation for the rest of the book.
  • You write your first search algorithm (binary search).
  • You learn how to talk about the running time of an algorithm (Big O notation).
  • You’re introduced to a common technique for designing algorithms (recursion).

Introduction

An algorithm is a set of instructions for accomplishing a task. Every piece of code could be called an algorithm, but this book covers the more interesting bits. I chose the algorithms in this book for inclusion because they’re fast, or they solve interesting problems, or both. Here are some highlights:

Get Grokking Algorithms 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.