liveBook · Manning

Chapter 1: The Language of Algorithms

What you will learn in chapter 1 of Algorithms Every Programmer Should Know

This introduction explains why algorithms matter in everyday software and why choosing one requires practical judgment, not just a search for theoretical optimality.

After this chapter you will be able to

Section by section

Introduction

This introduction explains why algorithms matter in everyday software and why choosing one requires practical judgment, not just a search for theoretical optimality.

Key terms: algorithms, performance, reliability, scalability, maintainability, correctness, theoretical optimality

1.1 Setting the Scene

This section explains why working programmers study algorithms even when libraries provide the implementations: to make sound engineering decisions and diagnose performance problems.

Key terms: algorithmic trade-offs, scalable architecture, systemic bottlenecks

1.2 Basics of Algorithms

This section defines algorithms as generalizable steps for well-specified problems and introduces how different algorithms can solve the same problem.

Key terms: algorithms, steps, inputs, expected output, insertion sort, bubble sort, selection sort, correctness, easy verifiability, easy implementation

1.2.1 Algorithms and why do we need them?

This section defines algorithms as problem-solving steps and explains why correctness, input coverage, constraints, and efficiency matter when choosing a solution.

Key terms: algorithm, inputs, correct answer, efficiency, time, memory, cost, scale, trade-off, brute force

1.3 Analysis of Algorithms

The section introduces algorithm analysis through efficiency, input size, and the best and worst cases of linear search.

Key terms: efficiency, input, memory, order of growth, linear search, worst-case analysis, best case, N, upper bound, lower bound

1.3.1 Time and Space Complexity

This section introduces time and space complexity and uses familiar search and sorting examples to show how resource use changes as input grows.

Key terms: time complexity, space complexity, input, additional data structures, constant time, O(1), linear time, O(N), linear search, N

1.4 Data Structures

This section explains why an algorithm’s performance depends on the data structure used to hold its data.

Key terms: data structures, time complexity, algorithms

1.4.1 Hash Maps

This section explains how hash maps use keys for fast access, where they are useful, and the tradeoffs that limit their use.

Key terms: hash map, key–value pairs, hash function, index, O(1), O(N), hash collisions, buckets, space complexity, key

1.4.2 Linked List and Doubly Linked List

This section explains how linked and doubly linked lists organize nodes and why their traversal, modification, and memory tradeoffs differ from arrays.

Key terms: linked list, node, data, next pointer, traversal, O(N), insertions, deletions, pointers, arrays

1.4.3 Stacks and Queues

The section explains how stacks and queues differ in removal order, where stacks are useful, and how their basic operations are implemented and analyzed.

Key terms: stack, queue, Last In, First Out (LIFO), First In First out (FIFO), function call, recursion, pushed, pops off, push, pop

1.4.4 Trees

This section introduces tree structure and binary-tree variants, then explains how depth-first and breadth-first traversal work and what they cost.

Key terms: tree, root, parent, child, leaf node, node, binary tree, full binary tree, perfect binary tree, left

1.4.5 Graphs

Introduces graphs as structures for interconnected networks and explains how to represent, traverse, and analyze them.

Key terms: graph, tree, cycle, node, Depth-First Search (DFS), Breadth-First Search (BFS), Visited Set, Queue, source node, starting node

1.5 Summary

Where this is used later

Concepts explained in this chapter

Chapter 2: Gale-Shapley Algorithm →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.