Open-source project
AllenDowney/ThinkDataStructures avatar
AllenDowney/ThinkDataStructures

Think Data Structures: a book repository that explains why it cut the usual material

LaTeX source and supporting code for Think Data Structures: Algorithms and Information Retrieval in Java

558 stars1,328 forksTeXMIT

At a glance

What is it?
The ThinkDataStructures repository holds the LaTeX source, example code and exercise solutions for Allen Downey's Think Data Structures, a Java book organised around web search rather than around containers. It suits a reader who wants the reasoning behind a compact algorithms curriculum, and it is a book project rather than a library.
Who is it for?
Think Data Structures is worth reading if you teach or learn data structures and have found the standard treatments either too theoretical, too long or too implementation-first, because the book answers that complaint with a specific structure, an interface-first order and a single running application, and because the repository ships the book source, the worked code and the exercise solutions together, so you can build the examples rather than only read them.
Can I use it commercially?
Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
Is it still maintained?
Yes. The repository last received commits 13 days ago.
What is it written in?
Mainly TeX, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on October 23, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What is actually in the repository

The ThinkDataStructures repository is the LaTeX source and supporting code for the book Think Data Structures: Algorithms and Information Retrieval in Java.

The tree is small and says what the project is: a book/ directory for the LaTeX sources, a code/ directory for the supporting code, a solutions/ directory for the exercise solutions, a PROJECT_BOARD.md, a LICENSE and a README. The primary language recorded for the repository is TeX, which is a useful signal, because it means the artefact at the centre of the project is a typeset book rather than a software package.

That has an immediate consequence for anybody considering the repository as a dependency. There is nothing to install and nothing to import. What you can do is read the source, build the book if you have a LaTeX toolchain, and run the example code, which is Java in a form that the exercises are written against.

The project is MIT licensed and has one tagged release, v1.1.0, published on 2026-10-10, with the last push to the repository on the same day. A single release for a book repository is unremarkable, but it does mean the book version and the repository contents move together, and the release note is the signal to look at when a new edition appears.

The most useful part of the repository for a reader is the README, because it is not a summary of the chapters. It is an argument about how the subject should be taught, and it is written in the first person with the disagreements stated plainly. The rest of this article is largely about that argument, because it is the part that makes the book different from the many other books on the same subject.

Three complaints about every other book on the subject

The author opens with the claim that data structures and algorithms are among the most important inventions of the last 50 years and are fundamental tools software engineers need to know, and then immediately criticises most of the books on the topic for being too theoretical, too big and too bottom-up.

Each complaint has a specific answer in the book.

On being too theoretical, the objection is that mathematical analysis of algorithms is based on simplifying assumptions that limit its usefulness in practice, and that many presentations gloss over the simplifications and focus on the math. The response is to present the most practical subset of the material and eliminate the rest. That is a choice about what a working engineer needs, not a claim that the analysis is wrong.

On being too big, the observation is that most books are at least 500 pages and some are more than 1000, and the response is to focus on the topics considered most useful for software engineers and keep the book under 250 pages. The target length is stated as a design constraint, which is unusual to see stated so plainly in a preface.

On being too bottom-up, the distinction is between how data structures work, which is the implementations, and how to use them, which is the interfaces. The book goes top down, starting with the interfaces, and readers learn to use the structures in the Java Collections Framework before getting into the details of how they work.

That last one is the decision with the most consequences for a reader, and it is the one that a Java developer will feel immediately. The same collection you have used for years is treated as a known interface first and an unfamiliar implementation second, which means the book spends its pages on the part a practitioner actually needs to make decisions and saves the internals for when the standard implementation is not enough.

One application running through the whole book

The author also objects to material being presented out of context and without motivation, which he describes as just one damn data structure after another, and the remedy is to organise the topics around an application, web search, that uses data structures extensively and is an interesting and important topic in its own right.

That is a structural decision, not a decoration. A book that hangs every data structure on one application has to answer a question for each of them that a catalogue would not, which is what is this structure for, in the context of a search engine, and the answer has to be consistent across the book. It also means the reader is building a mental model of a system rather than a list of recipes, and the knowledge transfers to problems the book never mentions.

The application also pulls in material that an introductory data structures course normally leaves out. The README names persistent data structures, with Redis, and streaming algorithms as topics that the web search application motivates but that are not usually covered. Persistent structures in particular are the difference between a data structure you can look at and one you can query a version of, which is a distinction that matters the moment you want to undo an operation or answer a question about the past.

So the shape of the book is: one application, and the data structures it requires, in the order the application needs them, with the interfaces first and the implementations second.

The compromises the author admits to, and how the exercises work

The README is unusually candid about the trade-offs, and it says there are difficult decisions about what to leave out but also some compromises.

The compromises are specific. A few topics are included that most readers will never use, but that they might be expected to know, possibly in a technical interview. For those, the author presents both the conventional wisdom and the reasons to be skeptical about it. That is a good way to handle the material that exists in a curriculum for reasons other than its usefulness, because it tells you both what the accepted answer is and why you should not simply accept it.

The exercises have a design that is worth explaining, because it is different from most textbooks. Each chapter ends with an exercise that lets readers apply what they have learned, and each exercise includes automated tests that check the solution. And for most exercises, the author's own solution is presented at the beginning of the next chapter.

Putting the solution at the start of the next chapter rather than in an appendix at the back is a small organisational choice with a large effect on how the book is used. The reader sees the problem, tries it, and finds the worked answer immediately afterwards, which keeps the exercise and the solution in the same piece of thinking. The automated tests are what make the exercises checkable rather than aspirational, and they are the reason the repository has a code/ and a solutions/ directory rather than only typeset text.

The book also covers basic aspects of software engineering practice, including version control and unit testing, which is a reasonable thing to include in a book aimed at people who are training as software engineers and at people preparing for technical interviews, and it reinforces the message that the exercises are real code.

Who the book is for, and what it is not

The stated audience is college students in computer science and related fields, professional software engineers, people training in software engineering, and people preparing for technical interviews.

The Java assumption is explicit. The author assumes the reader knows Java at an intermediate level, explains some Java features along the way, and provides pointers to supplementary material. People who have read Think Java or Head First Java are prepared for this book.

That last point is a good indicator of the register. Both of those are books that treat Java as a working language rather than as a teaching topic, and this one follows that convention, which means you will not find an introduction to classes here. You will find the collections framework treated as something you already use.

What the book is not is a reference. There is no indication that it aims to cover every collection in the Java Collections Framework comprehensively, and the stated editorial policy is the opposite, that most books are too big and that the author kept this one under 250 pages by focusing on the topics considered most useful. A reader looking for exhaustive coverage of the standard library, or for the academic treatment with the full proofs that the author considers too theoretical, will find neither here. What is here is a defended selection, and the defence is written down in the README rather than left implicit.

For the repository itself, the practical entry points are the book sources for anyone who wants to read the arguments in their original form with the exercises, the code directory for anyone who wants to run the examples against a working Java toolchain, and the solutions directory for anyone who has already attempted an exercise and wants to compare.

Editorial conclusion

Think Data Structures is worth reading if you teach or learn data structures and have found the standard treatments either too theoretical, too long or too implementation-first, because the book answers that complaint with a specific structure, an interface-first order and a single running application, and because the repository ships the book source, the worked code and the exercise solutions together, so you can build the examples rather than only read them. It is the wrong tool if you want a reference manual of every container in the Java Collections Framework. Before you adopt it, check three things: that you are comfortable with Java, since the book assumes an intermediate level and the companion Think Java is named as the preparation, and the code in the repository is Java; that you want the top-down order, because the whole argument rests on starting from interfaces and only then opening up implementations, and a reader who learns bottom-up will find it slow; and that you are using the current release, v1.1.0 from 2026-10-10, with the last push to the repository on the same day, so the LaTeX sources and the exercise code in the tree are in step with the book.

Frequently asked questions

What is in the ThinkDataStructures repository?

The LaTeX source and supporting code for the book Think Data Structures: Algorithms and Information Retrieval in Java, with a book/ directory for the sources, a code/ directory for the example code and a solutions/ directory for the exercise solutions. The primary language of the repository is TeX and the licence is MIT.

What makes Think Data Structures different from other data structures books?

The author argues that most books on the topic are too theoretical, too big and too bottom-up, and answers each one: the most practical subset of the material rather than the full analysis, a book kept under 250 pages, and a top-down order that starts with the interfaces and the Java Collections Framework before the implementations. The topics are organised around one application, web search, which also motivates persistent data structures and streaming algorithms.

Do the exercises in Think Data Structures come with solutions and tests?

Yes. Each chapter ends with an exercise, each exercise includes automated tests that check the solution, and for most exercises the author's own solution is presented at the beginning of the next chapter. The repository carries the supporting code and a solutions directory alongside the book sources.

Official sources

  1. AllenDowney/ThinkDataStructures on GitHub
  2. Issues
  3. License: MIT
  4. README
  5. Releases
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/allendowney-thinkdatastructures.svg)](https://hysenlabs.com/projects/allendowney-thinkdatastructures)

Was this useful?