10 Best Books to Learn Data Structure and Algorithms in Java, Python, C, and C++
Tags: beginners, java, python, books
Published: 2019-07-20 06:09:42

---
title: 10 Best Books to Learn Data Structure and Algorithms in Java, Python, C, and C++
published: true
description: Best books on data structure and algorithms for beginners in Java, Python, C, and C++. 
tags: beginners, java, python, books
cover_image: https://thepracticaldev.s3.amazonaws.com/i/zu6zeky3sdlf88esszmb.png
---
*Disclosure: This post includes affiliate links; I may receive compensation if you purchase products or services from the different links provided in this article.*

Algorithms are language agnostic and any programmer worth their salt should be able to convert them into code in the programming language of their choice, but at the same time, it's easier to learn if examples are presented in the programming language of your choice. 

Unfortunately, I have come across several programmers who are *REALLY* good at programming languages like [Java](http://www.java67.com/2018/08/top-10-free-java-courses-for-beginners-experienced-developers.html) or [Python](https://javarevisited.blogspot.com/2018/12/10-free-python-courses-for-programmers.html) like knows minor details of API and language intricacies but has very poor knowledge of fundamentals Algorithms and Data Structure.

Just ask them to implement any popular sorting algorithms like [quicksort](http://java67.blogspot.sg/2014/07/quicksort-algorithm-in-java-in-place-example.html) or [merge sort](http://www.java67.com/2018/03/mergesort-in-java-algorithm-example-and.html) and they will fall apart. If you expect them to know more advanced and complex algorithms like [String algorithms](https://dev.to/javinpaul/top-20-string-coding-problems-from-programming-job-interviews-493m), [graph algorithms](http://bit.ly/2NAbaIR), [tree traversal](https://javarevisited.blogspot.com/2016/10/post-order-binary-tree-traversal-in-java-iteration-recursion.html) or greedy algorithms, be ready to check on Interviews, otherwise, you might end up with some surprises.

Once, I come across a very good candidate for a core Java senior developer role, he was excellent in Java, [multi-threading](https://javarevisited.blogspot.com/2018/06/top-5-java-multithreading-and-concurrency-courses-experienced-programmers.html) but his data structure and algorithm skill was really poor to his experience and caliber.

When I asked him, why he didn't spend time brushing his algorithm and problem-solving skill before coming to the interview? His excuse was *"those algorithms are just for interviews and never really used in practical coding. I have never used them in my 6 years of Java development career"*.

He was somewhat right, you don't need to implement a hash table in Java, you can always use the [HashMap](http://www.java67.com/2017/08/top-10-java-hashmap-interview-questions.html) class or Dictionary in Python for that sense but he failed to recognize the more long term improvement algorithm and data structure do in [improving programming skill](https://javarevisited.blogspot.com/2014/01/10-tips-to-improve-programming-skill-become-better-programmer.html).

Algorithms are tools for developing programming solving skills and coding sense, which is required to convert a user requirement into the line of code also known as a computer program.

They are also all around, if you use Facebook, have you ever thought about how they find your friends so easily? Or how does Netflix recommends the movie you want to watch? Those are just a couple of examples of [**Machine Learning Algorithms**](https://pluralsight.pxf.io/c/1193463/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fmachine-learning-algorithms), which is taking Algorithms to another level.

In recent years, I also found that joining a solid algorithms and data structure course like [**Master the Coding Interview: Data Structures + Algorithms**](https://academy.zerotomastery.io/a/aff_nqb6sg6w/external?affcode=441520_zytgk2dn) on ZTM academy also helps to learn DSA better. You can use them to prepare quickly for your interview along with these books.

[![best coding interview course](https://res.cloudinary.com/practicaldev/image/fetch/s--nbwazR0h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wni9ridzh03l97nl0cqk.png)](https://academy.zerotomastery.io/a/aff_nqb6sg6w/external?affcode=441520_zytgk2dn)

Btw, you would need a [ZTM membership](https://academy.zerotomastery.io/a/aff_c0gnlvf7/external?affcode=441520_zytgk2dn) to watch this course which costs around $39 per month but also provides access to many super engaging and useful courses like [**Master the Coding Interview: Big Tech (FAANG) Interviews**](https://academy.zerotomastery.io/a/aff_rml6679s/external?affcode=441520_zytgk2dn) course. You can also use my code FRIENDS10 to get a 10% discount on any subscription you choose.



### Top 10 Data Structure and Algorithms Books on Java, Python, C, and C++ for Beginners and Experienced Programmers

Another gold tip to those who think that Algorithms are Data Structures are for those who want to work in [Amazon](https://javarevisited.blogspot.com/2016/01/top-20-amazon-and-google-programming-interview-questions.html), [Google](https://javarevisited.blogspot.com/2012/01/google-interview-questions-answers-top.html), Facebook, Intel or [Microsoft](https://javarevisited.blogspot.com/2015/12/30-microsoft-interview-questions-for-software-development-engineers.html), remember it is the only skill which is timeless, of course apart from [UNIX](http://www.java67.com/2018/02/5-free-linux-unix-courses-for-programmers-learn-online.html), [SQL](http://www.java67.com/2018/02/5-free-database-and-sql-query-courses-programmers.html) and [C programming language](https://medium.com/javarevisited/10-best-c-programming-courses-for-beginners-2c2c1f6bcb12).

>Programming languages come and go, but the core of programming, which is algorithm and data structure remains the same.

If you know how a hash table works then you can use their implementation in any programming language like [HashMap](http://www.java67.com/2013/02/10-examples-of-hashmap-in-java-programming-tutorial.html) from JDK, Dictionary in [Python](https://hackernoon.com/top-5-courses-to-learn-python-in-2018-best-of-lot-26644a99e7ec), or HashMap from [C++](https://hackernoon.com/top-5-free-c-courses-to-learn-programming-in-2019-d27352277da0) boost library.

So, if you are serious about programming and realizing now that algorithms and data structure is not optional, here are some of the great books to learn algorithms.

>Some of you might have already read them before but they are worth reading again. Btw, if you buy a book using links in this article, I'll get also get paid. 

**1\.** [**Introduction to Algorithms by Thomas H. Corman**](http://www.amazon.com/Introduction-Algorithms-Edition-Thomas-Cormen/dp/0262033844?tag=javamysqlanta-20)
This is one of the most popular algorithm books, but be aware that it contains a heavy dose of theory. The current edition of this book is the 3rd Edition and I strongly suggest that every programmer should have this on their bookshelf, but only for short reading and references.

It's not possible to finish this book in one sitting and some of you may find it difficult to read as well, but don't worry, you can combine your learning with an online course like [Data Structures and Algorithms: Deep Dive Using Java](https://click.linksynergy.com/fs-bin/click?id=JVFxdTr9V80&subid=0&offerid=323058.1&type=10&tmpid=14538&RD_PARM1=https%3A%2F%2Fwww.udemy.com%2Fdata-structures-and-algorithms-deep-dive-using-java%2F&u1=JAVAREVISITED) along with this book.

This is like the best of both worlds, you learn basic Algorithms quickly in an online course and then you further cement that knowledge by going through the book, which would make more sense to you now that you have gone through a course already.

Another reason I recommend this book as one of the first books on algorithm because of its language agnostic and accompanied by lectures [here](http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-046j-introduction-to-algorithms-sma-5503-fall-2005/index.htm)

[![best algorithms books for Java developes](https://cdn-images-1.medium.com/max/270/0*qyn7oS5yEK8kX5-Y.jpeg)](http://www.amazon.com/Introduction-Algorithms-Edition-Thomas-Cormen/dp/0262033844?tag=javamysqlanta-20)

-----

**2\.** [**Algorithms by Robert Sedgewick & Kevin Wayne**](http://www.amazon.com/Algorithms-4th-Edition-Robert-Sedgewick/dp/032157351X?tag=javamysqlanta-20)
This was my preferred resource on algorithms for a long time, it still is but now I see it less often than before. You will learn lots of background on the algorithm and nowadays even specific versions of this book are available for different programming languages like [Java](https://javarevisited.blogspot.com/2018/05/top-5-java-courses-for-beginners-to-learn-online.html) and [C++](http://www.java67.com/2018/02/5-free-cpp-courses-to-learn-programming.html).

There's also a couple of free Coursera online courses for this book,[**Algorithms Part 1**](https://coursera.pxf.io/c/3294490/1164545/14726?u=https%3A%2F%2Fwww.coursera.org%2Flearn%2Falgorithms-part1) and[**Algorithms Part 2**](https://coursera.pxf.io/c/3294490/1164545/14726?u=https%3A%2F%2Fwww.coursera.org%2Flearn%2Falgorithms-part2), which nicely complements this book. It's excellent. It's also my top recommendation to Java programmers for learning algorithms.


While on Coursera, it also has some of the best collection of Data Structure and Algorithms courses covering each and important topic. They are bundled together as [**Coursera Specialization on Algorithms**](https://coursera.pxf.io/c/3294490/1164545/14726?u=https%3A%2F%2Fwww.coursera.org%2Fspecializations%2Fdata-structures-algorithms). If you are keen on learning Algorithms in-depth, that's the place I would suggest you go.

Believe it or not but if you already know a programming language then seeing an example of an algorithm on that programming language than others also reduces the learning curve. *You can also read the 4th Edition of this book online for free *[*here*](http://algs4.cs.princeton.edu/home/)

[![best book to learn algorithms](https://cdn-images-1.medium.com/max/258/0*f_O5OdFDt-5SjEb8.jpg)](http://www.amazon.com/Algorithms-4th-Edition-Robert-Sedgewick/dp/032157351X?tag=javamysqlanta-20)

-----


**3\.** [**The Algorithm Design Manual by Steve S. Skiena**](http://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena/dp/1849967202?tag=javamysqlanta-20)
This is another excellent book on computer algorithms that go over a ton of algorithms with a lot of code as well. What I especially like about the book is where he actually gives examples of where he used the algorithms (or variations thereof) in practice; it really helps you see the class(es) of problems that a particular algorithm (or family of algorithms) can be used for.

The code is in [C](https://www.java67.com/2020/07/5-free-courses-to-learn-c-programming.html), but it's not very esoteric and it's easy to follow. I had also been out of school for a while and this helped me get up to speed quite quickly on a number of[**graph algorithms**](http://bit.ly/2NAbaIR). I've had this book for almost 10 years now and still look at it from time to time

[![best book to learn algorithms in depth for coding interviews](https://cdn-images-1.medium.com/max/223/0*QETEvia8vKTn9Wr-.jpg)](http://www.amazon.com/Algorithm-Design-Manual-Steven-Skiena/dp/1849967202?tag=javamysqlanta-20)

------


**4\.** [**Algorithm in Nutshell**](http://www.amazon.com/Algorithms-Nutshell-In-OReilly/dp/059651624X?tag=javamysqlanta-20)
O'Reilly's Algorithms, in a Nutshell, is a very good book to learn programming algorithms, especially for Java programmers. It describes the algorithms with a focus on implementing them and *without heavy mathematics* used in classic books on algorithms.

All algorithms are presented in pattern form, with a motivation to use them, pictures and pseudo-code giving a high-level overview, and working code (in [C](https://dzone.com/articles/5-free-courses-to-learn-data-structure-and-algorit), [C++](http://www.java67.com/2018/02/5-free-cpp-courses-to-learn-programming.html), [Java](https://javarevisited.blogspot.com/2018/05/top-5-java-courses-for-beginners-to-learn-online.html), and [Ruby](http://www.java67.com/2018/02/5-free-ruby-and-rails-courses-to-learn-online.html)).

They also have benchmarks to provide proof of the theoretical performance of the algorithms. In short, one of the best books to learn algorithms for programmers.

You can also combine this book with [*Master the Coding Interview: Data Structures + Algorithms**](https://academy.zerotomastery.io/a/aff_nqb6sg6w/external?affcode=441520_zytgk2dn) course on ZTM Academy to quickly get up-to-speed. 

[![best data structure and algorithms books for developers](https://cdn-images-1.medium.com/max/214/0*GLMXiKFTIECzjOQA.jpg)](http://www.amazon.com/Algorithms-Nutshell-In-OReilly/dp/059651624X?tag=javamysqlanta-20)

------

**5\.** [**Algorithm for Interviews**](http://www.amazon.com/Algorithms-For-Interviews-Adnan-Aziz/dp/1453792996?tag=javamysqlanta-20)
Algorithm for Interview by Adnan Aziz is a must-read book on algorithms, written in terms of keeping [programming interview](https://hackernoon.com/10-data-structure-algorithms-and-programming-courses-to-crack-any-coding-interview-e1c50b30b927) in mind.

The cover itself shows how interesting the book could be if you look closely at the image on the cover that is drawn with thumbnails of famous people, and the book explains how you can develop such algorithms. Interesting, isn't it?

Well, I like this book because of its approach and objective, sometimes learning the same thing with different objects helps to understand it better.

[![best algorithm books for coding interviews](https://cdn-images-1.medium.com/max/214/0*_OJBxJuCZmw2FtgG.jpg)](http://www.amazon.com/Algorithms-For-Interviews-Adnan-Aziz/dp/1453792996?tag=javamysqlanta-20)

-------

**6\.** [**Algorithm Design by Kleinberg & Tardos**](https://www.amazon.com/Algorithm-Design-Jon-Kleinberg/dp/0321295358?tag=javamysqlanta-20)\
This is actually the second-best book in Algorithms after Thomas Cormon's [Introduction to Algorithms](http://www.amazon.com/dp/0072970545/?tag=javamysqlanta-20). It's not really an introduction to algorithms and more suited to experienced programmers.

It's more about algorithm design for developers familiar with the basic algorithms. You should start with the Introduction of Algorithm book or Algorithms by Robert Sedgewick and then continue with this book.

Btw, if you like you can also combine your learning with an online course like [**Algorithms and Data Structures --- Part 1 and 2** ](https://pluralsight.pxf.io/c/1193463/424552/7490?u=https%3A%2F%2Fwww.pluralsight.com%2Fcourses%2Fads-part1)on [Pluralsight](https://medium.com/u/50a6c7ef7431). It's a nice course to get familiar with essential Algorithms and Data Structure before you move on to Algorithm Design topic.

[![best book to learn data structure and algorithms in depth](https://cdn-images-1.medium.com/max/252/0*CEsYxG1gmqm3X-2q.jpeg)](https://www.amazon.com/Algorithm-Design-Jon-Kleinberg/dp/0321295358?tag=javamysqlanta-20)

-----


**7\.** [**Introduction to Algorithms: A Creative Approach**](https://www.amazon.com/Introduction-Algorithms-Creative-Udi-Manber/dp/0201120372?tag=javamysqlanta-20)
Introduction to Algorithms: A Creative Approach By Udi Manber is another great book for self-study as it is full of hundreds of problems and examples.

It is designed to enhance the candidate's problem-solving abilities and understanding of the principles behind algorithm design, which will help you to develop your [Problem solving](http://www.java67.com/2018/06/data-structure-and-algorithm-interview-questions-programmers.html) and [Coding skills](http://www.java67.com/2016/02/5-books-to-improve-coding-skills-of.html).

[![best computer algorithms books for programmers ](https://cdn-images-1.medium.com/max/205/0*2cmFsOx36hZT9OLq.jpg)](https://www.amazon.com/Introduction-Algorithms-Creative-Udi-Manber/dp/0201120372?tag=javamysqlanta-20)

-------

**8\.** [**Data Structures and Algorithms. Aho, Ullman & Hopcroft**](https://www.amazon.com/Data-Structures-Algorithms-Alfred-Aho/dp/0201000237?tag=javamysqlanta-20)
Another good intro book on algorithms and data structures. A lovely and clear book and any programmer who doesn't like heavy use of Mathematics on the algorithm will appreciate this book.

Btw, if you find this book difficult to read, which is what some of my readers complain then you can also take a look at the [**Grokking Algorithms**](https://www.amazon.com/Grokking-Algorithms-illustrated-programmers-curious/dp/1617292230/?tag=javamysqlanta-20) by Aditya Bhargava, one of the easiest and interesting books on Algorithms for beginners.

[![best data structure book for software developers](https://cdn-images-1.medium.com/max/216/0*agQHC31LEJVozdIb.jpg)](https://www.amazon.com/Data-Structures-Algorithms-Alfred-Aho/dp/0201000237?tag=javamysqlanta-20)

-----

**9\.** [**The Design and Analysis of Algorithms**](https://www.amazon.com/Introduction-Design-Analysis-Algorithms-3rd/dp/0132316811?tag=javamysqlanta-20)
This is another great cook on computer algorithms and deserves a place on a programmer's shelf. Once you've gone through the [Coursera Specialization on Algorithms](https://coursera.pxf.io/c/3294490/1164545/14726?u=https%3A%2F%2Fwww.coursera.org%2Fspecializations%2Fdata-structures-algorithms) and one of the intro book, you can read this book for studying advanced topics in algorithms.

[![best algorithms book for experienced developers](https://cdn-images-1.medium.com/max/259/0*AhD6WH3KEMi8tFET.jpg)](https://www.amazon.com/Introduction-Design-Analysis-Algorithms-3rd/dp/0132316811?tag=javamysqlanta-20)

------

**10\.** [**Python Algorithms: Mastering Basic Algorithms in the Python Language**](https://www.amazon.com/Python-Algorithms-Mastering-Language-Experts/dp/1430232374?tag=javamysqlanta-20)\
This book is designed for Python programmers. Magnus Lie Hetland is also the author of one of the popular introductory Python books, [Beginning Python](https://www.amazon.com/Beginning-Python-Professional-Magnus-Hetland-ebook/dp/B06XGVVVMG?tag=javamysqlanta-20).

As I have told that algorithms are language-independent, learning python algorithm doesn't mean you cannot implement them in [Java](https://javarevisited.blogspot.com/2017/11/top-5-free-java-courses-for-beginners.html) or [C++](http://www.java67.com/2018/02/5-free-cpp-courses-to-learn-programming.html), but if you already know [Python](https://javarevisited.blogspot.com/2018/12/10-free-python-courses-for-programmers.html) then this is the great book to learn computer algorithms.

This book also gives a lot of focus on[**Graph Algorithms**](https://click.linksynergy.com/deeplink?id=JVFxdTr9V80&mid=39197&murl=https%3A%2F%2Fwww.udemy.com%2Falgorithms-and-data-structures-in-python%2F&u1=JAVAREVISITED), which is very useful in solving real-world problems.

[![best data structure and algorithms book for python developers](https://cdn-images-1.medium.com/max/260/0*5km05lVm_aETSfp8.jpg)](https://www.amazon.com/Python-Algorithms-Mastering-Language-Experts/dp/1430232374?tag=javamysqlanta-20)

-------


**11\.** [**Grokking Algorithms**](https://www.amazon.com/Grokking-Algorithms-illustrated-programmers-curious/dp/1617292230/?tag=javamysqlanta-20)
This is the book that was not part of the original series when I published this article on my blog but after reading this book, I ought to include this into the list because of its simplicity. 

It's one of the [best books I have read on algorithms](https://www.java67.com/2015/09/top-10-algorithm-books-every-programmer-read-learn.html), particularly from a beginners point of view.

It uses modern-day examples like how Facebook would have stored a username so that it can search it easily when login. These examples resonate better with beginners and help them to grasp the concept like why [array](http://www.java67.com/2012/12/difference-between-arraylist-vs-LinkedList-java.html) is a better choice than a [linked list](https://hackernoon.com/top-20-linked-list-coding-problems-from-programming-job-interviews-756d4a2bf652) for search.

Aditya's background in Fine arts also makes this book a visual learning resource. You will find so many interesting, to-the-point diagrams in this book which helps you to learn the concept better and quicker.

Here is a nice diagram that weighs this book with other algorithms book mentioned in this list:

[![best coding algorithms books](https://cdn-images-1.medium.com/max/640/1*E5W99IEVyE6jBCOUAgyRxQ.png)](https://www.amazon.com/Grokking-Algorithms-illustrated-programmers-curious/dp/1617292230/?tag=javamysqlanta-20)

In short, one of the *best Algorithms books for any beginner programmer*. It doesn't cover all the data structure and algorithms but whatever it covers, it explains them well.

That's all about **10 Algorithm books every programmer should read**. I agree that algorithms are a complex topic and it's not easy to understand them in one reading, in that case, I suggest reading the same book twice.

> Also just reading is not enough, try to implement them in a programming language you love. It doesn't hurt writing your own ArrayList, HashMap, or a tree-based Map implementation.

The effect of the learning Algorithm is not immediately visible but you will notice a subtle improvement in your thinking, solution building, and code quality over time.

Btw, if you are interested in an online course on algorithms, I suggest you check out [**Data Structures and Algorithms: Deep Dive Using Java**](https://click.linksynergy.com/fs-bin/click?id=JVFxdTr9V80&subid=0&offerid=323058.1&type=10&tmpid=14538&RD_PARM1=https%3A%2F%2Fwww.udemy.com%2Fdata-structures-and-algorithms-deep-dive-using-java%2F&u1=JAVAREVISITED)on Udemy. It's not a free course but you can buy in just under $10 to $15 on several of Udemy flash sales, which happens every few days

Other *Data Structure and Algorithms Articles** you may like

-   [5 Free Courses to Learn Algorithms and Data Structure](https://javarevisited.blogspot.com/2018/01/top-5-free-data-structure-and-algorithm-courses-java--c-programmers.html)
-   [50+ Data Structure and Algorithms Problems for Programmers](https://dev.to/javinpaul/50-data-structure-and-algorithms-problems-from-coding-interviews-4lh2)
-   [10 Data Structure and Algorithms Courses to Crack Programming Interviews](https://hackernoon.com/10-data-structure-algorithms-and-programming-courses-to-crack-any-coding-interview-e1c50b30b927)
-   [Top 5 Data Structure and Algorithm Books](https://javarevisited.blogspot.com/2015/07/5-data-structure-and-algorithm-books-best-must-read.html)
-   [10 Things Java Programmer Should Learn](https://javarevisited.blogspot.com/2017/12/10-things-java-programmers-should-learn.html#axzz5atl0BngO)
-   [image credit and good resource for Understanding Graph Theory & Algorithms](https://neo4j.com/blog/top-13-resources-graph-theory-algorithms/)
-   [30+ Array-based Coding Problems from Interviews](https://javarevisited.blogspot.com/2015/06/top-20-array-interview-questions-and-answers.html)
-   [30+ Linked list based Coding Problems from Interviews](https://javarevisited.blogspot.com/2017/07/top-10-linked-list-coding-questions-and.html)
-   [75+ Coding Problems from Interviews for Practice](http://www.java67.com/2018/05/top-75-programming-interview-questions-answers.html)
-   [My favorite list of free courses to learn Algorithms in Depth (freeCodeCamp)](https://www.freecodecamp.org/news/these-are-the-best-free-courses-to-learn-data-structures-and-algorithms-in-depth-4d52f0d6b35a)
-   [My favorite courses to learn Python for beginners](https://medium.com/better-programming/top-5-courses-to-learn-python-in-2018-best-of-lot-26644a99e7ec)

Thanks for reading this article, If you like this list of books then you would also enjoy my collection of [**10 books every programmer should read**](http://java67.blogspot.sg/2015/03/10-books-every-programmer-and-software-engineer-read.html)**,** which is a list of books on programming, coding, software development techniques, and best practices, computers, programming as profession and experience of some of the great programmers/coders/developers of last 50 years.

> At last, there are two types of programmers, one who understands the algorithm and one who doesn't.

You don't need to read all the books to become a data Structure and Algorithms champ, choose the book depending upon your favorite programming language and your experience. for absolute beginners, Grokking algorithms is better but for more comprehensive coverage Introduction to Algorithms is good. For tough interviews like Google and Facebook, Algorithms for Interviews and Algorithm Desing by Steve Skiena is a better choice. 

> **P. S. ---** If you prefer online courses over books or you want to learn from both books and online courses then you can also check out my list of [**Top 5 Online Courses to Learn Data Structure and Algorithms**](https://javarevisited.blogspot.com/2018/11/top-5-data-structures-and-algorithm-online-courses.html#axzz5YFaOvjsh)**.** It includes courses on Java, Python, and JavaScript for easy learning.