Algorithms and data structures are much more than abstract concepts. Mastering them enables you to write code that runs faster and more efficiently, which is particularly important for today’s web and mobile apps. Take a practical approach to data structures and algorithms, with techniques and real-world scenarios that you can use in your daily production code, with examples in JavaScript, Python, and Ruby. This new and revised second edition features new chapters on recursion, dynamic programming, and using Big O in your daily work.
Use Big O notation to measure and articulate the efficiency of your code, and modify your algorithm to make it faster. Find out how your choice of arrays, linked lists, and hash tables can dramatically affect the code you write. Use recursion to solve tricky problems and create algorithms that run exponentially faster than the alternatives. Dig into advanced data structures such as binary trees and graphs to help scale specialized applications such as social networks and mapping software. You’ll even encounter a single keyword that can give your code a turbo boost. Practice your new skills with exercises in every chapter, along with detailed solutions.
Use these techniques today to make your code faster and more scalable.
From the brand

Explore our collections

The Pragmatic Programmers publishes hands-on, practical books on classic and cutting-edge software development and engineering management topics. We help professionals solve real-world problems, hone their skills, and advance their careers.
Publisher : Pragmatic Bookshelf
Publication date : September 15, 2020
Edition : 2nd
Language : English
Print length : 508 pages
ISBN-10 : 1680507222
ISBN-13 : 978-1680507225
Item Weight : 2.06 pounds
Dimensions : 7.5 x 1.02 x 9.25 inches
Best Sellers Rank: #139,453 in Books (See Top 100 in Books) #10 in Computer Programming Structured Design #31 in Computer Systems Analysis & Design (Books) #194 in Computer Software (Books)
Customer Reviews: 4.8 4.8 out of 5 stars (831) var dpAcrHasRegisteredArcLinkClickAction; P.when(‘A’, ‘ready’).execute(function(A) { if (dpAcrHasRegisteredArcLinkClickAction !== true) { dpAcrHasRegisteredArcLinkClickAction = true; A.declarative( ‘acrLink-click-metrics’, ‘click’, { “allowLinkDefault”: true }, function (event) { if (window.ue) { ue.count(“acrLinkClickCount”, (ue.count(“acrLinkClickCount”) || 0) + 1); } } ); } }); P.when(‘A’, ‘cf’).execute(function(A) { A.declarative(‘acrStarsLink-click-metrics’, ‘click’, { “allowLinkDefault” : true }, function(event){ if(window.ue) { ue.count(“acrStarsLinkWithPopoverClickCount”, (ue.count(“acrStarsLinkWithPopoverClickCount”) || 0) + 1); } }); });
13 reviews for A Common-Sense Guide to Data Structures and Algorithms, Second Edition: Level Up Your Core Programming Skills
Add a review
$44.94


Andrew –
Buy it! An excellent and easily understandable guide to the most important algorithms!
What I was looking for:- A guide to help me advance my knowledge of data structures and algorithms (DS&A) using Python. (I am already proficient in Python, and I had previously completed one DS&A course. I was looking to take my skills to the next level.) Fortunately, I found nearly all of what I was looking for in one concise and accessible package. Most of the sample code in this book is written in Ruby, with a small amount written in Python. In the course download highlighted by the author, you can find Python code (along with Ruby and JavaScript) for solutions to the exercises. In my case, to learn the algorithms and complete the exercises, I converted relevant code to Python myself, and ran it in a Jupyter notebook or in the debugger included in VS Code 2. (The debugger is very helpful, as it enables you to set breakpoints and step through the code incrementally as it runs to see how variables, lists, sets, and dictionaries change.)What I liked:- The author is clearly an expert with a lot of practical experience building, analyzing, deploying, and improving algorithms- I found coverage of nearly all of the most important data structures and algorithms I was looking for- The book is very well-written, accessible, and not too long (~437 pages)–the editor did a great job- The author helpfully described (stepped-through) code execution when needed to clarify things- There was great coverage of string methods, arrays/lists, sets, hash tables (dictionaries), recursion, dynamic programming (memoization and bottom-up methods), linked lists and doubly linked lists, queues, binary search trees (BSTs), sorting methods, heaps, tries, graphs (weighted and unweighted), search methods (DFS and BFS), and more- There was useful context to help me understand when I might want to create an abstract data structure rather than rely on data structures already included in built-in Python modules- I accumulated more than 200 code snippets (algorithms) during my journey through the book- Chapter 20 included many useful tips for analyzing and speeding-up custom codeWhat I would have changed:- I would have preferred to see all the code in Python. If you are a reader who needs help understanding Ruby or converting Ruby to Python, your favorite AI chatbot (ChatGPT, etc.) can help you out.- It would have been helpful to see a discussion of space complexity (not just time complexity) much earlier in the book, so that the author could have discussed both types of complexities for each code snippet providedWhat I didn’t see and hope to find in the next edition:- Backtracking- ‘Sliding window’ technique- B-trees- A bit on the Greek letter notations for Big O (omega, theta, and omicron)- A bit more on techniques for visualizing the performance of custom code for comparison to standard time and space complexity benchmarksOverall, I would definitely recommend this book to others who would like to learn more about data structures and algorithms and write better code. It is a great book, and I am happy to tell others about my experience with it! If you need a digital version of this book (DRM-free pdf or epub), you can find it on eBooks.com.Final point: If you are looking for an excellent online course on Python data structures and algorithms, I highly recommend Scott Barrett’s course on Udemy (Python Data Structures & Algorithms + LEETCODE Exercises). Scott uses animations to describe what is happening in various types of algorithms, and that’s very helpful. I completed that course prior to using Wengrow’s book, and I learned a lot from both sources.
Phil –
Fantastic for aspiring developers
A fantastic book for the self taught cs or aspiring developer. It teaches ds&a from the ground up in a very intuitive way. Some books are overly theoretical with little practical examples, this book is the exact opposite.
Francis García –
What a book
This is the best DSA book ever. Well explained and detailed. It’s a must have for anyone who wants to level up his programming skills.
GeoffDantes09 –
Pretty good intro
As far as introducing the data structures this book takes a great visual approach. Algorithms are often easiest to understand in animated form but the step by step of this book is quite strong.The major weakness is by jumping between JS, Python, and Ruby you never fully develop any of them. Although the programmatic style is mostly translatable between these three languages it’s still typically better to do one thing fully rather than a few things partially. My feeling is that Ruby was the most represented of the three.All in all worth a read for the visualizations of the structures and algorithms.
Nathanial Carter –
Great read!
This book was very easy to understand and also really helped connect the dots for me. Really grateful I picked this one up!
Israel –
Easy to follow
Comprehensive, entertaining and very useful.There is nothing bad I can say about this book.
Tommy Kapone –
Great Intro to DS&A
Enjoyed reading the book and getting to know fundamentals of data structures and algorithms with it. I’m far enough in my self-taught programming to understand the examples but the switching between languages may be a challenge to newer programmers. If you’re strong with one of the languages used in the book you should find the other languages relatively easy to read though. Definitely a book I’ll recommend to my younger coworkers.
Anshul Singhal –
Very good book!
This is a very good book for data structures and algorithms. The only problem I see with this book is the author has used different programming languages for each and every example. some examples are written in java, ruby, python, js, etc. it would have been better if the author was stick to one language preferably python :). maybe it does not really matter much if you want to brush up on concepts.the examples in this book are not very difficult, so I don’t think this book is sufficient for interview prep for FANG companies, but still it is very good reference book. you would still have to refer to some other content online to get exposure to very difficult problems.
hsatou –
最近、同じ著者の「A Common-Sense Guide to Data Structures and Algorithms in Python, Volume 1」という本が出た。多分、同じ著者なのでクオリティは同じように高く、使用する言語をPythonに絞ったものに仕上がっているのだろう。こちらの本はアルゴリズムとデータ構造の実装をPython, Ruby, JavaScriptで行っている。私はJavaにあるデータコレクションがどんな役割を持っているのかさっぱり分からなくてこの本を読んだのだが、アルゴリズムとデータ構造の本としては全然堅苦しいことがなく、全くの初心者でも順に読み進めていけばLinked ListやStack、Graph、Treeといった代表的なデータ構造や各種のsortアルゴリズムや再帰の使い方について理解を深めることが出来るように書かれている。Leet Codeで問題を解いていくほうが実践的なアプローチだし、勉強にもなるが、その前にこの本を読んでおくとこのアルゴリズムはO(n)の処理速度であるといった説明に抵抗がなくなる。処理速度の定義などに細かく触れているからだ。それとLeet Codeは問題量が多すぎて、多くのデータ構造を大雑把にどんなものか理解しておきたいという目的には向いていない。アルゴリズムの本としては異例のコンパクトなこの本で必要な知識を入れてしまったほうが早い。実際のところ、Javaと違ってPythonやRubyには特定のデータ構造を実装したライブラリは少ないので、ほとんどのアルゴリズムは実際の実装で使う機会はないにしても、実装の仕方を知っているといればいざというときに役に立つというメリットもある。この本か著者の最新作でアルゴリズムに入門してLeet Codeでアルゴリズムとデータ構造の問題を沢山解いてみるというのが、プログラミングでより良い実装をするためには最も有効なアプローチであろう。初心者のプログラマーは言語やライブラリを覚えるのに時間がかかりすぎて、実際にどういう風に頭を働かせたらプログラムで問題を解決する勉強を怠りがちである。20年ちかく前にプログラミングを始めて勉強したときの私もまさにそうであった。そして成果物も十分になくプログラマーへの就職の機会を失ってしまい今に至る。今はなるべく本を読んだらその本から発展させてオリジナルのプロジェクトにしたりLeet Codeの問題に取り組んだりしているが、趣味でプログラミングをやる人がプログラミングを上達するには、実践的なアプローチがかかせない。そんなわけで、アルゴリズムとデータ構造に気軽に入門したい人、ただしTOEIC 700点以上の読解力のある方にはおすすめの本である。蛇足だが私はTOEIC 720点でプログラミングの本は不自由なく洋書でも読みこなせている。
Amit Saha –
The author does a fantastic job in covering a broad range of data structures and problem solving techniques. I work as a software engineer, and I don’t consider myself great at data structures and algorithms. This book certainly improved my confidence and provided me a refresher of the common ones that I am aware of, and know well. Additionally, it also taught me new topics that I hadn’t studied before.
Gustavo Caetano –
For some reason I see many people not recommending this book for beginners and recommending Grokking Algorithms instead. These people say this one is more advanced.I must say it’s not! It’s an amazing book, really well explained in layman terms. Illustrations are great and the play by play of algorithms is very efficient at helping you visualize the solutionsIt’s much better than Grokking Algorithms, IMO
BK –
The book is very comprehensive and easy to grasp, if you’re a beginner I definitely recommend it. But the author has included examples from both Ruby, Python and JS, and as someone with 0 Ruby knowledge, reading and understanding Ruby examples can be difficult at times. If you’re like me, I recommend buying this same book’s Python or JavaScript versions, as I also had to buy the Python version to grasp the material even better.
Jodorosso –
Una vera guida pragmatica degli algoritmi.Ti permette di “visualizzare” i concetti anche più complessi. Bellissima la spiegazione della nomenclatura O per la descrizione della velocità computazionale degli algoritmi.