Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the authors
OK
Think Data Structures: Algorithms and Information Retrieval in Java
Purchase options and add-ons
If you’re a student studying computer science or a software developer preparing for technical interviews, this practical book will help you learn and review some of the most important ideas in software engineering—data structures and algorithms—in a way that’s clearer, more concise, and more engaging than other materials.
By emphasizing practical knowledge and skills over theory, author Allen Downey shows you how to use data structures to implement efficient algorithms, and then analyze and measure their performance. You’ll explore the important classes in the Java collections framework (JCF), how they’re implemented, and how they’re expected to perform. Each chapter presents hands-on exercises supported by test code online.
- Use data structures such as lists and maps, and understand how they work
- Build an application that reads Wikipedia pages, parses the contents, and navigates the resulting data tree
- Analyze code to predict how fast it will run and how much memory it will require
- Write classes that implement the Map interface, using a hash table and binary search tree
- Build a simple web search engine with a crawler, an indexer that stores web page contents, and a retriever that returns user query results
Other books by Allen Downey include Think Java, Think Python, Think Stats, and Think Bayes.
- ISBN-101491972394
- ISBN-13978-1491972397
- Edition1st
- PublisherO'Reilly Media
- Publication dateAugust 22, 2017
- LanguageEnglish
- Dimensions6.9 x 0.3 x 9 inches
- Print length158 pages
![]() |
Frequently bought together

Customers who viewed this item also viewed
- Think Java: How to Think Like a Computer ScientistPaperbackFREE Shipping on orders over $35 shipped by AmazonGet it as soon as Tuesday, Aug 25Only 14 left in stock (more on the way).
- Data Structures and Algorithms in JavaHardcoverFREE Shipping by AmazonGet it as soon as Thursday, Aug 27Only 1 left in stock - order soon.
Customers also bought or read
- Head First Design Patterns: Building Extensible and Maintainable Object-Oriented Software 2nd Edition#1 Best SellerJava Programming
Paperback$30.68$30.68Delivery Tue, Aug 25 - Data Structures and Algorithms in Java: A Project-Based Approach
Hardcover$50.84$50.84FREE delivery Tue, Aug 25 - Prompt Engineering for Generative AI: Future-Proof Inputs for Reliable AI Outputs
Paperback$50.00$50.00FREE delivery Tue, Aug 25 - Hands-On Machine Learning with Scikit-Learn, Keras, and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
Paperback$48.99$48.99FREE delivery Sep 1 - 3 - Java Real World Projects: A pragmatic guide for building modern Java applications (English Edition)
Paperback$29.95$29.95Delivery Wed, Aug 26 - Code: The Hidden Language of Computer Hardware and Software#1 Best SellerMicrosoft Programming
Paperback$27.61$27.61Delivery Tue, Aug 25 - HTML & CSS: The Comprehensive Guide to Excelling in HTML5 and CSS3 for Responsive Web Design, Dynamic Content, and Modern Layouts (Rheinwerk Computing)
Paperback$51.36$51.36FREE delivery Tue, Aug 25 - Operating Systems: Three Easy Pieces#1 Best SellerComputer Operating Systems Theory
Paperback$28.27$28.27Delivery Wed, Aug 26 - x86 Software Reverse-Engineering, Cracking, and Counter-Measures (Tech Today)
Hardcover$38.51$38.51FREE delivery Tue, Aug 25 - Head First Java: A Brain-Friendly Guide#1 Best SellerBeginner's Guides to Java Programming
Paperback$43.99$43.99FREE delivery Tue, Aug 25
From the brand
-
See more books in the series
-
More From O'Reilly
-
Sharing the knowledge of experts
O'Reilly's mission is to change the world by sharing the knowledge of innovators. For over 40 years, we've inspired companies and individuals to do new things (and do them better) by providing the skills and understanding that are necessary for success.
Our customers are hungry to build the innovations that propel the world forward. And we help them do just that.
From the Publisher
The Philosophy Behind the Book
Data structures and algorithms are among the most important inventions of the last 50 years, and they are fundamental tools software engineers need to know. But in my opinion, most of the books on these topics are too theoretical, too big, and too 'bottom up'.
Too theoretical
Mathematical analysis of algorithms is based on simplifying assumptions that limit its usefulness in practice. Many presentations of this topic gloss over the simplifications and focus on the math. In this book I present the most practical subset of this material and omit or de-emphasize the rest.
Too big
Most books on these topics are at least 500 pages, and some are more than 1,000. By focusing on the topics I think are most useful for software engineers, I kept this book under 150 pages.
Too 'bottom up'
Many data structures books focus on how data structures work (the implementations), with less about how to use them (the interfaces). In this book, I go 'top down', starting with the interfaces. Readers learn to use the structures in the Java Collections Framework before getting into the details of how they work.
Finally, some books present this material out of context and without motivation: it’s just one damn data structure after another! I try to liven it up by organizing the topics around an application—web search—that uses data structures extensively, and is an interesting and important topic in its own right.
This application motivates some topics that are not usually covered in an introductory data structures class, including persistent data structures with Redis.
I have made difficult decisions about what to leave out, but I have made some compromises. I include a few topics that most readers will never use, but that they might be expected to know, possibly in a technical interview. For these topics, I present both the conventional wisdom as well as my reasons to be skeptical.
This book also presents basic aspects of software engineering practice, including version control and unit testing. Most chapters include an exercise that allows readers to apply what they have learned. Each exercise provides automated tests that check the solution. And for most exercises, I present my solution at the beginning of the next chapter.
Editorial Reviews
About the Author
Allen B. Downey is a Professor of Computer Science at Olin College of Engineering. He has taught at Wellesley College, Colby College, and U.C. Berkeley. He has a Ph.D. in Computer Science from U.C. Berkeley and Master’s and Bachelor’s degrees from MIT.
Product details
- Publisher : O'Reilly Media
- Publication date : August 22, 2017
- Edition : 1st
- Language : English
- Print length : 158 pages
- ISBN-10 : 1491972394
- ISBN-13 : 978-1491972397
- Item Weight : 9.6 ounces
- Dimensions : 6.9 x 0.3 x 9 inches
- Best Sellers Rank: #449,331 in Books (See Top 100 in Books)
- #55 in Computer Programming Structured Design
- #91 in Java Programming
- #232 in Software Design & Engineering
- Customer Reviews:
About the authors

Allen Downey is a Professor Emeritus at Olin College and Principal Data Scientist at PyMC Labs. He is the author of several books related to programming and data science, including Probably Overthinking It, Think Python, Think Stats, and Think Bayes. The idea behind these books is that if you know how to program, you can use that skill to learn other things.
Allen has a Ph.D. from U.C. Berkeley and M.S. and B.S. degrees from MIT. He has taught at Olin College, Colby College and Wellesley College.

Discover more of the author’s books, see similar authors, read book recommendations and more.

Discover more of the author’s books, see similar authors, read book recommendations and more.
Customer reviews
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonTop reviews from the United States
- 5 out of 5 stars
Great book if you already know another programming language.
Reviewed in the United States on May 25, 2019I have many years experience writing C code, and some C++, so I knew the basics of programming. This book has been great for me to dig into Java, not too basic, and not too complex. I'm using it as a self driven course in Java, especially learning more about collections.
Although the book is not thick, as some have said, it is written straight to the point, with dense information on each page. And the exercises have been great to force myself into getting into the details of the language. I feel this book is worth a semester or two of an intermediate Java college course.
5 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Harnassing the power of Java
Reviewed in the United States on July 24, 2018Format: PaperbackVine Customer Review of Free ProductThink Data Structures is a helpful guide in understanding and utilizing a wealth of data structures provided in the Java programming language.
Though the book is a thin, lightweight volume, it is packed with helpful information and code that illustrates the power under the hood of the ubiquitous Java. Any serious student, or professional practitioner, of Java would benefit from a reading of this book. It highlights such storage essentials as linked lists, arrays, hash maps, as well as binary trees, list traversals and Big O Notation. The latter refers to a code’s efficiency measured by how many calculations and processor work is required for each method, function or class in a program. Understanding and implementing the most efficient code will help programmers not simply have code that works, but that also is lean and mean resource wise.
I really enjoyed seeing not simply explanations of code but the code itself. Also, once a concept is explained it must be understood to make headway with the succeeding lessons. While I would recommend this book to anyone who wishes to learn how to write efficient, powerful Java code, it’s probably best suited for someone with at least a familiarity of Java, object oriented programming, and data structures (especially lists and hashes or maps).
6 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 4 out of 5 stars
Good coverage, but probably not for a novice
Reviewed in the United States on November 8, 2017Format: PaperbackVine Customer Review of Free ProductAs someone who has been coding for years (but is just now learning Java), I found this book to be pretty good.
I like how it's clearly written for someone who is beyond the beginner level when it comes to coding (no slog through basic data types like so many other coding books I've read), and is looking for a more formal discussion of data structures.
Writing is concise and clear, well-structured, and each section includes sample code and a basic exercise (not a lot of nuance here, though -- if you're looking for a bunch of exercises like what you'd find in a textbook, this isn't the book for you) to check your understanding. I think the author succeeds in his stated goal of covering a lot of material without getting too far into the weeds of theory, basic building blocks, etc.
My one complaint is that it's a bit slim (physically, it's not even 200 pages). It covers a lot and does a surprisingly good job of bringing depth to the discussion, but if you were to have difficulty with something it'd be hard to get yourself unstuck with this book.
6 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Clear, practical instruction in a slim book that’s not slim on usefulness
Reviewed in the United States on October 15, 2017Format: PaperbackVine Customer Review of Free ProductIn the preface, Downey states that he is trying to write a book that avoids the common pitfalls of being too theoretical, too big, and too “bottom up.” He has succeeded. In a way, Downey uses some of the structure of good storytelling in his instruction, which leads to more engagement and enjoyment. Rather than just a list of instructions, he builds up the reader’s knowledge by instructing on a specific “quest”, in this case, building a web search engine. This helps the reader’s mind follow along and build a base of knowledge. This knowledge can then be applied to other applications, as well. It’s a more natural way of learning, somewhat like being his apprentice.
I’m impressed enough with what I learned and how enjoyable the learning was, that after writing this review, I’m going to take a look at what other books Downey has to offer.
3 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
Excellent terse Data Structures in Java book
Reviewed in the United States on November 18, 2017Format: PaperbackVine Customer Review of Free ProductAllen Downey writes wonderfully terse books that hit the important concepts, and this is another example. Sometimes I find Downey's books to be nice complements to more lengthy books that describe the concepts in more detail or more gradually/gently, and yet somehow manage to miss some important concepts. As mentioned in the introductory section, you should be comfortable in Java before taking on this book, including knowing how to define a new class that extends an existing class. This book would be good for CS students with the expected background as well as programmers generally more comfortable in another language and trying to get up to speed in Java.
4 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 5 out of 5 stars
I think that it does a good job of striking the balance it claims to
Reviewed in the United States on September 25, 2017Solid book. I think that it does a good job of striking the balance it claims to.
Sending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 4 out of 5 stars
Short And Straight To The Point
Reviewed in the United States on November 5, 2017Format: PaperbackVine Customer Review of Free ProductThis is a more condensed, straight-to-the-point book for learning about different data structures and algorithms to use them. What this book won't give you is a lot of conceptual information behind each algorithm. Rather, it begins with a summary of the structure e.g. a hash, leads with example code and has an exercise at the end of each chapter using what you learn. So, the book's structure is: 'topic' + 'example' + 'output' + 'additional expounding' + 'exercise'. It is very good for getting to the 'meat', and learning how to use it.
Personally, I really appreciate the way it is written. Clear language, straight to the point, and examples. This book shows you how to use and implement them immediately, which is the type I prefer to save time. Total pages are around 120, and topics are kept short.
Know that you must know how to use Java in order to understand and use the examples and perform the exercises. Not necessarily complex Java or arcane packages, however you need to be able to create, compile and run Java code to include interfaces and classes.
Some example chapters include: Interfaces, Arrays, LinkendList, TreeMap, Binary Search Trees, Web Crawling, jsoup usage, indexing, linear maps, and hash maps to name a few.
Overall very clear book that gets straight to the point for data structures and simple algorithms in Java.
4 people found this helpfulSending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again - 3 out of 5 stars
Good enough for refreshing the material
Reviewed in the United States on June 29, 2020I have to admit I did not do the web crawler project as I was just interested in the concepts. A novice might find the exercises helpful, but I didn’t. A very sad decision made by the author was to focus a lot of the content on tools specific for the web crawling project. I enjoyed the first chapters and skimmed the last few ones.
Sending feedback...Sending feedback...HelpfulThank you for your feedback.Sorry, we failed to record your vote. Please try againThanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
Top reviews from other countries
aurélie4 out of 5 starsGood but every other paragraph , the author tells you to check a link/his website for further info
Reviewed in the United Kingdom on July 10, 2023I am half way through the book and I enjoy reading it . I got this book to get off the computer and read about Data structures. In the preface the author mentions how most Data structures books are about 500 pages and his is about 150 pages and that he was able to put everything within 150 pages but in fact every other paragraph, he gives you a link to his website for further reading so he didn't make a concise book , he just gives you links for the other 350 pages he removed.
In the end I'll have to buy the 500 pages book because I don't want to check a link every paragraph , few lines even if I know some of it already ,I wanted to read the theory off the computer.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
PRASHANT UJJAINKAR5 out of 5 starsFive Stars
Reviewed in India on July 2, 2018very useful book :)


very useful book :)
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
ALEXANDRE5 out of 5 starsMuito bom! Vale a pena
Reviewed in Brazil on August 28, 2022Esse foi o livro que me inspirou a gostar do assunto e ver a importância em saber mais sobre ciência da computação e não simplesmente aprender uma linguagem e sair codificando da forma mais bonitinha que é mostrado nos exemplos para iniciantes.
Sending feedback...Thanks, we'll investigate in the next few days.Sorry, We failed to report this review. Please try again
















