Any good algorithm book will describe the algorithms in abstract terms, and not just in one particular language. Because after all, you can implement them in any language. I would recommend "Introduction to Algorithms" by CLRS (Cormen, Leierson, Rivest, Stein). The algorithms are described in pseudocode, not in any particular programming language. For example, their insertion sort is "implemented" as follows: for i = 2 to n key = A[i] // insert A[i] into the sorted subarry A[1:i - 1] j = i - 1 while j > 0 and A[j] > key A[j + 1] = A[j] j = j - 1 A[j + 1] = key You might notice that this already looks close to Python (and that their array indices are 1-based). IIRC Guido was inspired by how pseudocode looks (which is not standardized, just an ad hoc way to describe algorithms in a language neutral way); that's why there's the "Python is runnable pseudocode" memes, and stuff like this . Another popular book is "Algorithms" by Robert Sedgewick; I've never read it, but I assume the algorithms are also described in pseudocode. I've found a github repo where people implement the algorithms in Python. Of course there's also the holy bible TAOCP by Knuth, but that's more a reference for experienced people, as it is incredibly information dense and mathematical. Knuth himself said that "2 pages in my book is somebody's entire career work". Answer from Yoghurt42 on reddit.com
🌐
Reddit
reddit.com › r/learnpython › best python books for data structure and algorithms (dsa) ?
r/learnpython on Reddit: Best Python books for Data Structure and Algorithms (DSA) ?
August 1, 2024 -

So I wanna learn DSA then completely dive into Data Science and after that ML and DL, But first thing first I need to know which book would be good for me to learn DSA by using python ?

(I know that using book as primary source for studying would not be the best choice but the thing is I have much time so I wanna learn things deeply and clearly)

EDIT--Thanks for all your advice, Now I am going with "Data Structures and Algorithms in Python by  Michael H. Goldwasser, Michael T. Goodrich, and Roberto Tamassia".

Top answer
1 of 7
12
Maybe unpopular opinion, but python is bad for learning DSA, especiallythe DS part. I did a DSA course in C# and everything makes sense when you have declared types, build your classes and so on. However, if you are doing the same challenges in python, there are always the questions of - why not just use a list/dict/ordered dict. You have to counterintuitively write lower level things that python already handles.
2 of 7
8
Any good algorithm book will describe the algorithms in abstract terms, and not just in one particular language. Because after all, you can implement them in any language. I would recommend "Introduction to Algorithms" by CLRS (Cormen, Leierson, Rivest, Stein). The algorithms are described in pseudocode, not in any particular programming language. For example, their insertion sort is "implemented" as follows: for i = 2 to n key = A[i] // insert A[i] into the sorted subarry A[1:i - 1] j = i - 1 while j > 0 and A[j] > key A[j + 1] = A[j] j = j - 1 A[j + 1] = key You might notice that this already looks close to Python (and that their array indices are 1-based). IIRC Guido was inspired by how pseudocode looks (which is not standardized, just an ad hoc way to describe algorithms in a language neutral way); that's why there's the "Python is runnable pseudocode" memes, and stuff like this . Another popular book is "Algorithms" by Robert Sedgewick; I've never read it, but I assume the algorithms are also described in pseudocode. I've found a github repo where people implement the algorithms in Python. Of course there's also the holy bible TAOCP by Knuth, but that's more a reference for experienced people, as it is incredibly information dense and mathematical. Knuth himself said that "2 pages in my book is somebody's entire career work".
🌐
Reddit
reddit.com › r/learnpython › what is the best course/book for data structures & algorithms using python?
r/learnpython on Reddit: What is the best course/book for data structures & Algorithms using Python?
August 24, 2022 -

Hey, just learning Python as my first programming language.

Reading Python Crash Course, Automate the boring stuff and learn code by solving problems (python) and then doing 100 day udemy project challenge.

I understand that I need solid knowledge in data structs/algor for interviews/leetcode/life

Anyone has good suggestions? preferably that is easy to follow/read.

Thank you!

🌐
Reddit
reddit.com › r/python › a good book about data structure and algorithms in python?
r/Python on Reddit: A good book about data structure and algorithms in python?
August 13, 2022 -

I recently had a job ingerview where they asked me questions about data structures in python that needed a deep knowledge of how dictionaries (hashes) work in python under the hood. I know data structures and algorithms is not bonded to any language but given how python works I bet there is something python focused out there. Any help?

Ps: questions like: how would you implement a data structure that can have the methods "get", "set" and "set_all" (sets values for all the keys present) and is O(1)? Or, how would you create a "cache" of a given size that removes the least used object when the size is surpassed and keeps the most used object in top of the "pile" of the cache, and all operatios are O(1)?

🌐
Reddit
reddit.com › r/learnpython › best data structures & algorithms textbook written in python?
r/learnpython on Reddit: Best data structures & algorithms textbook written in Python?
June 22, 2020 -

Hi all,

I am trying to learn more about the DS & Algos side of things, and am looking for a book that comprehensively covers both.

The only book I've uncovered so far is Grokking Algorithms, it's nice that it's covered in Python, but it's mostly algorithms and I'm missing the data structures portion.

Can anyone make any recommendations?

Thank you!

🌐
Reddit
reddit.com › r/learnpython › "data structures & algorithms in python", goodrich, tamassia, goldwasser - any reccomendations ?
r/learnpython on Reddit: "Data Structures & Algorithms in Python", Goodrich, Tamassia, Goldwasser - any reccomendations ?
August 30, 2019 -

Hi all, as above really.

1 year heavy experience programming in python (postgrad in computational chemistry + my own side projects) but looking to move beyond scripting to programming.

Was wondering if anyone had experience with the above text for data structures and algorithms (a topic that's always recommended round here!).

I think it looks readable enough, but I like having examples to learn from so wondered if other text books would be similar in their approach or not.

Thank you for the feedback and hope you enjoy your Friday night!

Top answer
1 of 5
25
Not personally familiar with it, but a quick Amazon search shows that the same authors have written essentially the same book for different languages: Data Structures and Algorithms in Java, ...in C++, ...in Python. However it is confusing to do this search as there are several other books that use the same words, "Data Structures and Algorithms" but they are by other authors. Using the "Look Inside" feature I note that in the intro, they say the Python version is improved over the others in several ways. Scrolling to the beginning of chapter 1 they say the book is based on "Python 3.1 and later". It is good that in 2013 they committed to Python 3, but it is now 6 years and 6 dot-versions behind the state of the art, including the async features and several others. It would be good if they'd rewrite it to use 3.8 and all its features. Scrolling on I am not impressed with their pedagogy. They dump a lot on the student in the first few topics, bouncing between the assignment statement to class methods and mutability. So many concepts so fast, with no code to make them real or show their application. The student is going to be memorizing a whole list of terms and definitions without ever applying any of them. Jeez, they even introduce the frozenSet class before the dict, and still without a single executable example. Expressions and operator precedence, you meet every operator and reserved word in the language in what is called a "Python Primer" section. Lots of luck remembering all that, student, when you need it. And on and on: you basically have to learn the entire language, functions, argument passing, the entire list of builtins, I/O operations, try/except/raise, comprehension syntax! -- and you have not written one line of code yet. Based on this admittedly cursory review, I would not recommend this for either a class or for self-study. Since you've had a fair amount of experience, try Python 201 which gets into the use of the standard lib modules. Or Doug Hellman's Python 3 Standard Library by Example .
2 of 5
10
Yes. This book is highly recommended. This is the 101 algorithms book. These are the questions that are asked in programming interviews. Try this: http://interactivepython.org/runestone/static/pythonds/index.html
🌐
Reddit
reddit.com › r › learnpython › comments › lqsrei › question_python_books_on_data_structures_and
Question: Python Books on Data Structures and Algorithms
February 23, 2021 - Subreddit for posting questions and asking for general advice about all topics related to learning python. ... Can anyone suggest any books that cover data structures (linked lists, trees, stacks etc) where the examples are in python?
🌐
Reddit
reddit.com › r/python › data structures and algorithms
r/Python on Reddit: Data Structures and Algorithms
December 17, 2021 -

Hey all,

I'm looking for a book or course to learn data structures and algorithms. I came across the following three but am curious for input from the community. The first two had a few concerning reviews about quality and incorrect code. I'm open to other books or courses as well. Thanks!

Data Structures and Algorithms in Python

Data Structures and Algorithms with Python (Springer)

Problem-Solving with Algorithms and Data Structures Using Python

MIT OpenCourseWare Introduction to Algorithms

Find elsewhere
🌐
Reddit
reddit.com › r/learnprogramming › data structures and algorithms: books/resources for python
r/learnprogramming on Reddit: Data Structures and Algorithms: Books/resources for Python
July 7, 2016 -

I want to begin learning data structures and algorithms with python and I'm looking for resources/advice.

Background info:

Sometime ago I thought Java was a more appropriate language for learning this subject so I picked up Algorithms, fourth edition by Sedgewick. I picked up this book because it is more approachable than CLRS and the examples are in Java.

I actually haven't touched this book because I was learning how to do other things with Python (e.g. web dev) but now, I want to learn this subject. After some reading, I discovered that the language doesn't matter a whole lot and it's probably better that I stick with Python since that is the language I already know.

At this point, I'm unsure if I should stick with Algorithms by Sedgewick, switch to another book, or supplement with another book. Since the coded examples in the Segewick book are in Java, i would have to learn enough java to impliment the code in Python, but at that point, I might be better off using Java. Not sure.

The two books that come to mind:

  1. Data Structure and Algorithmic thinking with Python (Karumanchi), https://www.amazon.com/Data-Structure-Algorithmic-Thinking-Python/dp/8192107590

  2. Data Structures and Algorithms in Python (Goodrich), https://www.amazon.com/Structures-Algorithms-Python-Michael-Goodrich/dp/1118290275/ref=sr_1_4?ie=UTF8&qid=1467858397&sr=8-4&keywords=goodrich+data+structures#customerReviews

My thinking is to work my way through the first resource and use the sedgewick book as a reference to understand the theory. The second book looks comprehensive but less popular (but probably because Java is more commonly used for learning this stuff in the university).

I'm aware of interactive python but I read that the resources is too basic.

🌐
Reddit
reddit.com › r/learnpython › how to learn algorithms and data structures
r/learnpython on Reddit: How to learn Algorithms and Data Structures
January 2, 2021 -

Hello everyone,

i am an engineer and basically tought myself how to code, because i would like to go for machine learning. I am not an expert yet.

I often read or heard that algorithms and data structurs and all that are super important for coding and even if i think i make quite a good progress in learning, i often feel like i am missing the basics.

It's so much out there. Like tons of youtubers and online courses and some fancy bootcamp thing (Until recently i didn't even know something like that exists). Like Udemy, coursera, edx, youtube, tons of books, kaggle, leetcode, algoexpert, the list is endless. Everything is full of advertisement and i have no idea what i should go for...

What source can you recommend me to learn this stuff theoretically and practically preferable in python? I would prefer videos over a book and a big course that covers everything rather than a bit of this topic here and a bit of that topic there and stuff. I don't mind if it is some sort of academic and mathematically, but it should cover some practice aswell.

I was thinking about just going for this:

https://www.edx.org/xseries/mitx-computational-thinking-using-python

But not sure if it's deep enough. I don't even know how deep i have to understand all that. I am not planning to go for some PhD. I Just want to go for a Job at the interface of machine learning/coding and engineering, but i also realy want to understand this whole topic as deep as possible. So I don't want to spend hours and hours on following some course just to begin another course right after. If that's the only way, fine. But maybe someone has a good recommendation?

🌐
Reddit
reddit.com › r/learnpython › of these 3, which is the best algo/data structures book?
r/learnpython on Reddit: Of these 3, Which is the best Algo/Data Structures book?
October 19, 2019 -

I've gotten to the point in my Python learning journey where I'm interested in learning algorithms and data structures. I'm not a big fan of online video courses as I prefer to read books to learn.

Right now, I'm considering buying one of the following books: Grokking Algorithms, Problem Solving with Algorithms and Data Structures, and Cracking the Coding Interview.

Assuming I have zero knowledge of algorithms (which is true), but an intermediate knowledge of python as a language, which do you recommend?

PS - Python is my first programming language.

  • also.. some concerns I have is that the first two books I mentioned seem way too short, only 250 pages. While the 3rd book is longer (700) but is written in Java.

🌐
Reddit
reddit.com › r/learnpython › good book for dsa in python
r/learnpython on Reddit: Good book for DSA in python
October 9, 2023 -

I'm looking to dive into Data Structures and Algorithms (DSA) in Python to prepare for FAANG interviews, as I find Python more comfortable than C++. However, I'm a bit overwhelmed with the available resources. Can anyone recommend a reliable online course or book for learning DSA in Python that's well-suited for FAANG interview preparation?

🌐
Reddit
reddit.com › r/learnpython › how best to learn data structures and algorithms?
r/learnpython on Reddit: How best to learn data structures and algorithms?
September 19, 2023 -

So, pretty much every career advice skills lists includes - or even leads with - DSA. Obviously, there are numerous books available on these topics, but what's the best way to actually practice these things?

I certainly know of linked lists, heaps, hash tables, etc, but reading the theory is at best half the battle.

Some info about my specific situation:

My interest is in the area of data analysis.

My resources are the books "A Common-Sense Guide to Data Structures and Algorithms", "Data Structures the Fun Way", "Dive into Algorithms".

I primarily practice on Stratascratch (which doesn't really cover this at all).

Thanks for any advice.

🌐
Reddit
reddit.com › r/learnpython › best place to learn data structures and algorithms
r/learnpython on Reddit: Best place to learn Data Structures and Algorithms
January 7, 2020 -

Hi guys, I am learning python on my own from a month and facing lot of problem in solving the problem with in time. So I understood that I have to get a good at data structures and algorithms and watched bunch of videos and understood the concept of what are sorts but I am unable to write my own code for sorting using python. Are there any good resources for learning Data Structures and Algorithms ?It is becoming stupid that I could solve the problem linearly but couldn't do it in time for larger input cases and its frustrating.