Dive Into Algorithms Cover

Dive Into Algorithms

A Pythonic Adventure for the Intrepid Beginner
by Bradford Tuckfield
January 2021, 248 pp.
Lay-flat binding

Look Inside!


Dive Into Algorithms is a wide-ranging, Pythonic tour of many of the world's most interesting algorithms. With little more than a bit of computer programming experience and basic high-school math, you'll explore standard computer science algorithms for searching, sorting, and optimization; human-based algorithms that help us determine how to catch a baseball or eat the right amount at a buffet; and advanced algorithms like ones used in machine learning and artificial intelligence. You'll even explore how ancient Egyptians and Russian peasants used algorithms to multiply numbers, how the ancient Greeks used them to find greatest common divisors, and how Japanese scholars in the age of samurai designed algorithms capable of generating magic squares.

You'll explore algorithms that are useful in pure mathematics and learn how mathematical ideas can improve algorithms. You'll learn about an algorithm for generating continued fractions, one for quick calculations of square roots, and another for generating seemingly random sets of numbers.

You'll also learn how to:

  • Use algorithms to debug code, maximize revenue, schedule tasks, and create decision trees
  • Measure the efficiency and speed of algorithms
  • Generate Voronoi diagrams for use in various geometric applications
  • Use algorithms to build a simple chatbot, win at board games, or solve sudoku puzzles
  • Write code for gradient ascent and descent algorithms that can find the maxima and minima of functions
  • Use simulated annealing to perform global optimization
  • Build a decision tree to predict happiness based on a person's characteristics

Once you've finished this book you'll understand how to code and implement important algorithms as well as how to measure and optimize their performance, all while learning the nitty-gritty details of today's most powerful algorithms.

Author Bio 

Bradford Tuckfield is a data scientist, a consultant, and a writer. He received a PhD from the Wharton School of the University of Pennsylvania, and a BS in Mathematics from Brigham Young University. He is the author of Dive Into Algorithms (No Starch Press) and Applied Unsupervised Learning with R (Packt). In addition to working as a data scientist and tech manager for top finance firms and startups, his research has appeared in academic journals spanning math, business management, and medicine.

Table of contents 

Chapter 1: Problem-Solving With Algorithms
Chapter 2: Algorithms in History
Chapter 3: Maximizing and Minimizing
Chapter 4: Sorting and Searching
Chapter 5: Pure Math
Chapter 6: Advanced Optimization
Chapter 7: Geometry
Chapter 8: Language
Chapter 9: Machine Learning
Chapter 10: Artificial Intelligence
Chapter 11: Forging Ahead

View the Copyright Page
View the detailed Table of Contents
View the Index


“This book is based entirely on learning math, but it does a really good job of changing how it’s learned. Instead of trying to give you a dry math lecture, this book will tell a story with each of its chapters. This story based education ties real world problems and solutions with the algorithms that this book is trying to teach.”
—Ian Mizer, Cloud Support Engineer

“An excellent self-discovery approach to learning algorithms.”
—Ira Laefsky, Vine Voice

“A clear and concise introduction to algorithmic thinking. This is especially important in today's world where resolving processes using computers is far more important than ever before. Python is not the main focus of the book, more like the algorithmic language using which a variety of topics are explored. Top marks for content and style.”
—Brian G. McEnery, Amazon Reviewer

“[This] book has been great about teaching you what you need to know to do each section! I'd recommend giving it a shot!”

Extra Stuff 

Click here to download the code files.


View the latest errata.