Jump to ratings and reviews
Rate this book

40 Algorithms Every Programmer Should Know: Hone your problem-solving skills by learning different algorithms and their implementation in Python

Rate this book
Learn algorithms for solving classic computer science problems with this concise guide covering everything from fundamental algorithms, such as sorting and searching, to modern algorithms used in machine learning and cryptography Algorithms have always played an important role in both the science and practice of computing. Beyond traditional computing, the ability to use algorithms to solve real-world problems is an important skill that any developer or programmer must have. This book will help you not only to develop the skills to select and use an algorithm to solve real-world problems but also to understand how it works. You’ll start with an introduction to algorithms and discover various algorithm design techniques, before exploring how to implement different types of algorithms, such as searching and sorting, with the help of practical examples. As you advance to a more complex set of algorithms, you'll learn about linear programming, page ranking, and graphs, and even work with machine learning algorithms, understanding the math and logic behind them. Further on, case studies such as weather prediction, tweet clustering, and movie recommendation engines will show you how to apply these algorithms optimally. Finally, you’ll become well versed in techniques that enable parallel processing, giving you the ability to use these algorithms for compute-intensive tasks. By the end of this book, you'll have become adept at solving real-world computational problems by using a wide range of algorithms. This book is for programmers or developers who want to understand the use of algorithms for problem-solving and writing efficient code. Whether you are a beginner looking to learn the most commonly used algorithms in a clear and concise way or an experienced programmer looking to explore cutting-edge algorithms in data science, machine learning, and cryptography, you'll find this book useful. Although Python programming experience is a must, knowledge of data science will be helpful but not necessary.

374 pages, Paperback

Published June 12, 2020

84 people are currently reading
175 people want to read

About the author

Imran Ahmad

42 books8 followers
Imran Ahmad is affiliated with the Food Engineering and Bioprocess Technology program at the Asian Institute of Technology, Thailand.

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
7 (17%)
4 stars
8 (19%)
3 stars
6 (14%)
2 stars
10 (24%)
1 star
10 (24%)
Displaying 1 - 12 of 12 reviews
Profile Image for Daval Davis.
45 reviews
May 7, 2021
Rubbish. Skips around topics, without any actual depth. And it has all of the editorial expertise that i've come to expect from Packt books, which is to say, no editing at all. Page 39 shows a lambda that squares values, and then describes it as "Multiplication by two". Page 64 illustrates insertion sort with a diagram of shell sort.

At best, this book would serve as a source for topics you might want to look up in other, better books.
Profile Image for Marek Sirkovský.
49 reviews2 followers
April 16, 2022
The book is not good. There are many difficult to grasp concepts without proper explanation. Just superficial algorithm descriptions. The book's name should be a brief catalog of algorithms.
Profile Image for Vishwanath.
45 reviews7 followers
July 27, 2020
The table of contents was comprehensive and a bit ambitious to be fair. Great outline for anyone wanting to learn a host of subjects from Supervised/Unsupervised ML, Cryptography, Basic data processing concepts and storage algorithms. The list of algorithms was well summarized and small examples that serve as good reference material for a quick refresher. Brevity was an advantage and disadvantage here as the concise chapters were engaging and to the point. However, the vastness of the subject matter left little space for the author to dive in deep into any area. Some chapters felt like a mashup of material across different topics. Also, the organization of the book ( e-book on the safari website in my case) was poor - the algorithms don't seem to be numbered per a sequence and the table of contents were not either - not sure if the publisher is still making edits though the release date indicates June 2020. The code consists of simple implementations in scikit-learn which is useful for the ML algorithms as a quick refresher.
Profile Image for Jascha.
151 reviews
January 15, 2021
A very disappointing book. The choice of the presented algorithms is limited. Each is described very shortly.
5 reviews
April 15, 2022
A messy unsourced blob of keywords. Mostly about machine learning, not really about algorithms in general.

This has no works cited, was clearly not peer reviewed, and the editor didn’t catch several formatting issues (such as incorrect figures). The author himself doesn’t seem to be a credible source. Experience in teaching beginner python courses, even if it’s google paying him, does not qualify the author as an authoritative source on machine learning.

The learning curve was very jagged. At times it was so slow it feels like a beginner book, and other times it reads like the GNU Haskell Compiler Manual in just how fast it expects the reader to pick things up.

Often it feels out-of order, and I’m not sure where the number 40 came from.

After chapter five or so, none of the python libraries (which are extremely use-case specific) are explained. The code using the library is merely shown, even though it would be very on-topic to explain the “why” of the code they show instead of only a cursory explanation of what this code might be used for.

If a second edition of this book were to be released, I might read it, but in its current state I cannot recommend this book to educators, hobbyists, or professionals wanting to expand horizons.
6 reviews
September 3, 2020
I thought the organization of the book was good but the in-depth examples that are really needed were not there. I like the beginner's aspect but that's about as far as I would see this being useful. If you are new to Data Science or Machine Learning, I can recommend the book as a feasible primer. The examples were good but overall, I'd recommend more of a code repository approach where the author would demonstrate with the limited examples as shown then forward to the public repository for end-to-end code.
Profile Image for Brandon Denning.
24 reviews11 followers
November 9, 2020
Decent overview but lacks depth

Covers a lot of different algorithm types and their uses but many are glossed over or oversimplified. I can't really fault the author though as the book would need to be 10x as long to cover each in depth.

The expected categories are covered though (sorting, graph traversal, etc). When you get to areas like hashing though, they cover 2 common ones (MD5 and SHA-512) and explain how, in general - as you would give to a non-programmer, hashing works and how to run in Python using a library.
600 reviews11 followers
May 21, 2023
It starts very academically but for the first chapter that style worked. It showed the importance of algorithms and how many mistakes in software development could be stopped at an early point. Unfortunately, the book keeps going on at a too academic level, what may be useful for a course at a university. For everyone else, the style gets boring too fast, and I missed an explanation on why it selected those 40 algorithms and not different ones. There are a few interesting problems discussed in the book, but again, split over so many parts that it is annoying to get the full picture.
Profile Image for esplovago.
75 reviews15 followers
July 19, 2022
Un insieme di contenuti senza alcun filo logico, per giunta spiegati male (a volte in maniera superficiale, altre in maniera iper-tecnica).

Inoltre la traduzione italiana contiene vari errori di battitura e anche alcuni termini tradotti in maniera non propriamente corretta (questo è strano per Apogeo, che solitamente fornisce ottime traduzioni).
Profile Image for Evan Pacini.
54 reviews
February 16, 2022
A great source of inspiration, but not a source of information. The topics in the book are all quickly ran over without any kind of depth, making it difficult to learn anything from the book. However, the topics are quite interesting, but not enough for me to recommend the book.
Profile Image for Hongjian Wang.
19 reviews
November 2, 2023
not worth reading
if you know the concept already, then you finish the book in 40 minutes.
if you don't know the concept previously, i doubt you will learn them in this book
Displaying 1 - 12 of 12 reviews

Can't find what you're looking for?

Get help and learn more about the design.