
Algorithms are just step-by-step algorithms for solving problems, and most of these problems have already been solved, tested and verified by someone. You can, of course, immerse yourself in the deep philosophy of the genius Knut, study multi-page folios with proofs and rationales, but do you want to spend your time for this?
Open a beautifully illustrated book, and you will immediately realize that the algorithms are easy. And rocking algorithms is a fun and exciting experience.
About the book
I (Aditya Bhargava) above all wanted to make the book easy to read. I avoid unexpected turns; Every time a new concept is mentioned in a book, I either explain it immediately, or say where I will explain it. The basic concepts are supported by exercises and repeated explanations so that you can check your assumptions and make sure that you have not lost the thread of presentation.
')
The book provides many examples. My goal is not to throw a bunch of obscure formulas onto the reader, but to simplify the visual presentation of these concepts. I also think that we learn best when we can remember something already known, and examples help us refresh our memory. So when you remember how arrays differ from linked lists (Chapter 2), just remember how you are looking for places for a company in a movie theater. Probably, you have already understood that I am a supporter of the visual style of learning - the book is full of drawings.
The content of the book has been carefully thought out. It makes no sense to write a book with a description of all sorting algorithms - for this there are sources such as Wikipedia and the Khan Academy. All algorithms described in the book are of practical value. I used them in my work as a programmer, and they lay a good foundation for studying more complex topics.
Book structure
The first three chapters lay the foundations:
Chapter 1 - you learn your first non-trivial algorithm: binary search. It also discusses the basics of analyzing the speed of algorithms using the "O-large". This entry is often used in the book to describe the relative speed of execution of algorithms.
Chapter 2 - You will be introduced to two fundamental data structures: arrays and related lists. These data structures are often found in a book and are used to create more complex data structures, such as hash tables (Chapter 5).
Chapter 3 - you will learn about recursion - a convenient technique used by many algorithms (for example, a quick sort algorithm, which is described in Chapter 4).
In my experience, the topics “O-large” and recursion are difficult for beginners, so in these sections I reduce the rate of presentation and provide more detailed explanations. The rest of the book presents algorithms that are often used in different areas.
Methods for solving problems are discussed in Chapters 4, 8, and 9. If you are faced with a difficult task and do not know how to effectively solve it, use the divide and conquer strategy (Chapter 4) or the dynamic programming method (Chapter 9). And if you understand that there is no effective solution, try to get an approximate answer using the greedy algorithm (Chapter 8).
Hash tables are discussed in Chapter 5. Hash tables are an extremely useful data structure for storing key and value pairs (for example, a person’s name and email address or a user name and password). It is difficult to overestimate the practical usefulness of hash tables. When starting to solve a problem, I usually first ask myself two questions: can I use a hash table here and can I simulate a problem in the form of a graph.
Graph algorithms are discussed in Chapters 6 and 7. Graphs are used to model networks: social, road, neural, or any other set of connections. Search in width (Chapter 6) and Dijkstra's algorithm (Chapter 7) are designed to find the shortest distance between two points of the network: they can be used to calculate the shortest route to the destination point or the number of intermediate friends of two people in a social network.
The k-nearest-neighbor algorithm is discussed in Chapter 10. This is a simple machine learning algorithm; it can be used to build a recommender system, an optical text recognition engine, a stock price forecasting system — in short, everything that requires predicting values (“We think Adit will give this movie 4 stars”) or object classification (“This is the letter Q”) .
The next step: Chapter 11 presents 10 algorithms that are well suited for further study of the topic.
Who is this book for?
This book is intended for readers who possess the basics of programming and want to understand the algorithms. Maybe you have already encountered the problem of programming and are trying to find an algorithmic solution.
Or maybe you want to understand where algorithms can be useful to you. The following is a short and incomplete list of people who may find the book useful:
- self-taught programmers;
- students who start learning programming;
- graduates who want to refresh their memory;
- specialists in physics / mathematics / other disciplines interested in programming.
about the author
Aditya Bhargava is a programmer at Etsy, the online authoring market. He holds a master’s degree in computer science from the University of Chicago and runs the popular illustrated technical blog
adit.io.»More information about the book can be found on
the publisher's website.»
Table of Contents»
ExcerptFor Habrozhiteley a 25% discount on the coupon -
Algorithms