Programming and Algorithms
This book connects a precise model of a program to the choice and implementation of an algorithm. Language primers and type systems establish what code means; the algorithm chapters develop invariants, complexity, and data-structure choices; the practice chapters ask you to predict behavior and defend implementations across languages. The order-book case study shows those choices working together. Generating an implementation is easy to delegate; understanding its semantics and choosing evidence for its correctness remain your work.
76 sections
Start readingGlossaryContents
Section titled “Contents”Languages and models
Section titled “Languages and models”- 1.1 Python and numpy: arrays, dtypes, broadcasting, views vs copies, uv projects
- 1.2 Shell, git, make, processes: exit codes, signals, environment, pipes
- 1.3 C: memory, pointers, structs, headers, and the C11 toolchain
- 1.4 Rust: ownership, traits, Result, cargo workspaces, std TCP
- 1.5 HTTP/1.1, JSON, and Server-Sent Events from the wire up
- 1.6 Go: packages, interfaces, goroutines, channels, context, net/http, testing
- 1.7 Containers and Kubernetes: images, layers, Pods, Deployments, Services, Helm, kind
- 1.8 Python asyncio: event loop, tasks, cancellation, bounded concurrency
- 1.9 Async Rust and tokio: futures, tasks, channels, cancellation, hyper
- 1.10 Protocol Buffers and gRPC: schema evolution, unary and streaming RPCs, stubs
- 1.11 SQL and SQLite: schema, transactions, WAL mode, indexes, aggregates
Algorithms and data structures
Section titled “Algorithms and data structures”Predict, explain, and implement
Section titled “Predict, explain, and implement”What you will be able to do
Section titled “What you will be able to do”- Explain values, ownership, types, concurrency, and language behavior with concrete examples.
- Choose data structures and algorithms from their invariants and complexity.
- Predict an output before executing a program and diagnose the rule behind a surprise.
- Validate an implementation with boundary cases, counterexamples, and resource measurements.
- Defend an end-to-end build using its correctness and performance evidence.
Ways through this book
Section titled “Ways through this book”Read the parts in order for the full progression, or choose a route below and follow its prerequisites. Pause at the review questions before revealing worked answers.
- Learning a language: Language and Tool Primers, then Type Systems and Polymorphism, then Predict-Then-Read.
- Developing algorithmic reasoning: Arrays and hashing, then Graphs, then Dynamic programming, then Competitive Programming.
- Explaining implementations: C, then C++, then Case Study: Order Book Matching.
Before you start
Section titled “Before you start”Start with one language and a terminal. Mathematics supplies discrete mathematics, probability, and the foundations for complexity arguments. Software Engineering develops testing and maintenance as engineering practices. Executable prediction and implementation projects remain under practice/; their explanations belong to this book.
How to read these books explains the shared first-principles, prediction, reasoning, testing, and validation method.