Customers who viewed this item also viewed
Buy new:
-20% $32.17$32.17
FREE delivery Monday, February 9 on orders shipped by Amazon over $35
Advertisement
Ships from: Amazon.com Sold by: Amazon.com
Save with Used - Very Good
$20.08$20.08
FREE delivery February 12 - 18
Advertisement
Ships from: bellwetherbooks Sold by: bellwetherbooks
Sorry, there was a problem.
There was an error retrieving your Wish Lists. Please try again.Sorry, there was a problem.
List unavailable.
Download the free Kindle app and start reading Kindle books instantly on your smartphone, tablet, or computer - no Kindle device required.
Read instantly on your browser with Kindle for Web.
Using your mobile phone camera - scan the code below and download the Kindle app.
Follow the author
OK
The Recursive Book of Recursion: Ace the Coding Interview with Python and JavaScript
Purchase options and add-ons
Recursion has an intimidating reputation: it’s considered to be an advanced computer science topic frequently brought up in coding interviews. But there’s nothing magical about recursion.
The Recursive Book of Recursion uses Python and JavaScript examples to teach the basics of recursion, exposing the ways that it’s often poorly taught and clarifying the fundamental principles of all recursive algorithms. You’ll learn when to use recursive functions (and, most importantly, when not to use them), how to implement the classic recursive algorithms often brought up in job interviews, and how recursive techniques can help solve countless problems involving tree traversal, combinatorics, and other tricky topics.
This project-based guide contains complete, runnable programs to help you learn:
- How recursive functions make use of the call stack, a critical data structure almost never discussed in lessons on recursion
- How the head-tail and “leap of faith” techniques can simplify writing recursive functions
- How to use recursion to write custom search scripts for your filesystem, draw fractal art, create mazes, and more
- How optimization and memoization make recursive algorithms more efficient
Al Sweigart has built a career explaining programming concepts in a fun, approachable manner. If you’ve shied away from learning recursion but want to add this technique to your programming toolkit, or if you’re racing to prepare for your next job interview, this book is for you.
- ISBN-101718502028
- ISBN-13978-1718502024
- PublisherNo Starch Press
- Publication dateAugust 16, 2022
- LanguageEnglish
- Dimensions7 x 0.75 x 9.25 inches
- Print length328 pages
Frequently bought together

Deals on related products
Customers also bought or read
- Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples
Paperback$30.99$30.99Delivery Mon, Feb 9 - Dive Into Algorithms: A Pythonic Adventure for the Intrepid Beginner
Paperback$31.06$31.06FREE delivery Feb 12 - 19 - Object-Oriented Python: Master OOP by Building Games and GUIs
Paperback$36.08$36.08FREE delivery Feb 19 - 21 - Beyond the Basic Stuff with Python: Best Practices for Writing Clean Code
Paperback$28.19$28.19Delivery Feb 19 - 21 - Algorithmic Thinking, 2nd Edition: Learn Algorithms to Level Up Your Coding Skills
Paperback$32.49$32.49Delivery Mon, Feb 9 - Think Like a Programmer: An Introduction to Creative Problem Solving
Paperback$25.89$25.89Delivery Feb 18 - 28 - Impractical Python Projects: Playful Programming Activities to Make You Smarter
Paperback$24.88$24.88Delivery Mon, Feb 9 - The Big Book of Small Python Projects: 81 Easy Practice Programs
Paperback$40.59$40.59FREE delivery Mon, Feb 9 - Modeling and Simulation in Python: An Introduction for Scientists and Engineers
Paperback$30.63$30.63$3.99 delivery Feb 27 - Mar 4 - Graph Algorithms the Fun Way: Powerful Algorithms Decoded, Not Oversimplified
Paperback$29.99$29.99Delivery Mon, Feb 9 - Practical SQL, 2nd Edition: A Beginner's Guide to Storytelling with Data#1 Best SellerComputer Programming Structured Design
Paperback$21.49$21.49Delivery Mon, Feb 9 - Math for Deep Learning: What You Need to Know to Understand Neural Networks
Paperback$35.68$35.68FREE delivery Mon, Feb 9 - Learn to Code by Solving Problems: A Python Programming Primer
Paperback$23.73$23.73Delivery Feb 18 - 21 - The Secret Life of Programs: Understand Computers -- Craft Better Code
Paperback$30.12$30.12$3.99 delivery Fri, Feb 27 - How Cybersecurity Really Works: A Hands-On Guide for Total Beginners
Paperback$26.01$26.01FREE delivery Sat, Feb 14 - How Computers Really Work: A Hands-On Guide to the Inner Workings of the Machine
Paperback$28.26$28.26$3.99 delivery Feb 19 - 25 - Serious Python: Black-Belt Advice on Deployment, Scalability, Testing, and More
Paperback$32.60$32.60Delivery Mon, Feb 9 - Fluent Python: Clear, Concise, and Effective Programming
Paperback$43.99$43.99FREE delivery Mon, Feb 9 - Python Crash Course, 3rd Edition: A Hands-On, Project-Based Introduction to Programming#1 Best SellerIntroductory & Beginning Programming
Paperback$27.53$27.53Delivery Mon, Feb 9 - The Algorithm Design Manual (Texts in Computer Science)
Hardcover$48.45$48.45FREE delivery Mon, Feb 9 - Doing Math with Python: Use Programming to Explore Algebra, Statistics, Calculus, and More!
Paperback$25.04$25.04$3.99 delivery Feb 19 - 25 - JavaScript: The Definitive Guide: Master the World's Most-Used Programming Language#1 Best SellerJavaScript Programming
Paperback$34.30$34.30Delivery Mon, Feb 9 - Dead Simple Python: Idiomatic Python for the Impatient Programmer
Paperback$47.05$47.05FREE delivery Feb 19 - 23 - The Rust Programming Language, 2nd Edition#1 Best SellerObject-Oriented Software Design
Paperback$29.49$29.49Delivery Feb 25 - Mar 1
Editorial Reviews
Review
—John D. Cook
"... this book is a worthy read for a developer who wants to deepen their knowledge of advanced programming topics. While basic recursion is included in early programming curriculum, it typically stops at examples that can be reproduced with iteration. In this book, Al Sweigart starts are these basics and quickly expands to include types of algorithms that benefit from recursion, such as tree traversal and divide-and-conquer. Though focused on those actively interviewing for engineering roles, the book is also a good fit for professional development, an engineering book club, or a brain tickler for your technical book shelf. The real life projects at the end are especially informative, which is why I think... (this review 'recurs' to the beginning)"
—Adam DuVander, @adamd, Founder of EveryDeveloper
"I have felt for a long time that I had a pretty good handle on the subject of recursion . . . Thanks to Al Sweigart's new book, I think I'm far better informed than I was before. I will re-read this book a couple more times, just to add to the knowledge."
—Ronnie Tucker, Editor, Full Circle Magazine
About the Author
Product details
- Publisher : No Starch Press
- Publication date : August 16, 2022
- Language : English
- Print length : 328 pages
- ISBN-10 : 1718502028
- ISBN-13 : 978-1718502024
- Item Weight : 1.35 pounds
- Dimensions : 7 x 0.75 x 9.25 inches
- Best Sellers Rank: #231,980 in Books (See Top 100 in Books)
- #33 in JavaScript Programming (Books)
- #121 in Computer Programming Languages
- #189 in Python Programming
- Customer Reviews:
About the author

Al Sweigart is a software developer and tech book author living in Houston. He has written several programming books for beginners, including Automate the Boring Stuff with Python. His books are freely available under a Creative Commons license at his website https://inventwithpython.com.
Related products with free delivery on eligible orders
Customer reviews
- 5 star4 star3 star2 star1 star5 star97%0%0%3%0%97%
- 5 star4 star3 star2 star1 star4 star97%0%0%3%0%0%
- 5 star4 star3 star2 star1 star3 star97%0%0%3%0%0%
- 5 star4 star3 star2 star1 star2 star97%0%0%3%0%3%
- 5 star4 star3 star2 star1 star1 star97%0%0%3%0%0%
Customer Reviews, including Product Star Ratings help customers to learn more about the product and decide whether it is the right product for them.
To calculate the overall star rating and percentage breakdown by star, we don’t use a simple average. Instead, our system considers things like how recent a review is and if the reviewer bought the item on Amazon. It also analyzed reviews to verify trustworthiness.
Learn more how customers reviews work on AmazonReviews with images
A must to have book which can make a good developer a great developer.
Top reviews from the United States
There was a problem filtering reviews. Please reload the page.
- Reviewed in the United States on December 22, 2024Format: PaperbackVerified PurchaseMany others have already said wonderful things about this book, and I wholeheartedly agree with them. As a Ph.D. in Applied Mathematics and Statistics, I find myself in an unusual position: despite the growing necessity of coding in modern research and experimentation, I simply don’t enjoy it. While I believe I have the capacity to code, it has never been something I truly liked. That’s why Al’s books have been a revelation for me. Al is a great educator. He has a talent of teaching programming in a way that resonates. It truly got me intrigued. I’ve purchased several of his books to show my gratitude.
- Reviewed in the United States on January 30, 2026Format: PaperbackThe Recursive Book of Recursion teaches recursion in a clear, methodical way that actually helps you understand how it works, rather than just showing patterns to memorize. The explanations build gradually, making complex ideas feel approachable instead of abstract or intimidating.
The Python and JavaScript examples are well designed and reinforce the underlying concepts, helping you develop the right mental model for recursive thinking. The exercises are meaningful and encourage real understanding, not trial-and-error coding.
Overall, this is a well-structured, thoughtful book for anyone who wants to genuinely learn recursion and feel confident applying it in real code. Highly recommended for developers who want a deeper, clearer grasp of this topic.
- Reviewed in the United States on September 7, 2022Format: KindleI encourage folks learning programming to first buy Al Sweigart’s book, “Automate the Boring Stuff with Python”. That book teaches you Python from the beginning and assumes no previous knowledge. The book used in conjunction with his video course on Udemy, similarly named “Automate the Boring Stuff with Python”, are a great way to start learning Python.
His latest book, "The Recursive Book of Recursion", takes the reader into the more advanced subject of recursion. Topics include the concepts of the stack, pushing in and popping out of the stack, and stack overflow. Recursion is compared to iteration, and examples are shown where both approaches are shown and critiqued. Cases where recursion is advantageous are presented with illustrations to enhance one’s comprehension. While not a beginner’s book, it is a good read to fill in a sufficiently complex subject. Copious Python and JavaScript recursion code are provided. Some fun and cool demonstrations of recursion make use of turtle graphics. Going forward, this will be my ‘go-to’ reference for recursion. Thank you, Al Sweigart!
Here’s a breakdown of what’s included (from the book):
Introduction - Covers how to set up Python and JavaScript on your computer to follow along with the code examples in the rest of the book.
Part 1: Understanding Recursion
Chapter 1: What is Recursion? - Explains recursion and how it is the natural result of the way programming languages implement functions and function calls. This chapter also argues that recursion isn’t nearly the elegant, mystical concept many claim it is.
Chapter 2: Recursion vs. Iteration – Dives into the differences (and many similarities) between recursive and iterative techniques.
Chapter 3: Classic Recursion Algorithms – Covers famous recursive programs such as the Tower of Hanoi, the flood fill algorithm, and others.
Chapter 4: Backtracking and Tree Traversal Algorithms – Discusses a problem for which recursion is particularly suited: traversing tree data structures, such as when solving mazes and navigating a directory.
Chapter 5: Divide-and-Conquer Algorithms – Discusses how recursion is useful for splitting large problems into smaller subproblems and covers several common divide-and-conquer algorithms.
Chapter 6: Permutations and Combinations – Covers recursive algorithms involving ordering and matching, as well as the common programming problems to which these techniques are applied.
Chapter 7: Memoization and Dynamic Programming – Explains some simple tricks to improve code efficiency when applying recursion in the real world.
Chapter 8: Tail Call Optimization – Covers tail call optimization, a common technique used to improve the performance of recursive algorithms, and how it works.
Chapter 9: Drawing Fractals – Tours the intriguing art that can be programmatically produced by recursive algorithms. This chapter makes use of turtle graphics for generating its images.
Part 2: Projects
Chapter 10: File Finder – Covers a project that searches through the files on your computer according to custom search parameters you provide.
Chapter 11: Maze Generator – Covers a project that automatically generates mazes of any size using the recursive backtracker algorithm.
Chapter 12: Sliding-Tile Solver – Covers a project that solves sliding-tile puzzles, also called 15-puzzles.
Chapter 13: Fractal Art Maker – Explore a project that can produce custom fractal art of your own design.
Chapter 14: Droste Maker – Explores a project that produces recursive, picture-in-picture images using the Pillow image-manipulation module
Finally, I would also recommend another one of his earlier books, “Cracking Codes with Python”. This is an excellent book on using Python to encrypt, decrypt, and cracking various encryption algorithms.
- Reviewed in the United States on November 19, 2022Format: PaperbackIt may seem odd that a book devoted entirely to recursion would contain such statements as “You never need to use recursion. No programming problem requires recursion … In fact, a recursive function might be an overcomplicated solution…” Nevertheless, Al Sweigert goes on to explain the ins and outs of a programming technique you should rarely, if ever, need to use. And he does so masterfully.
Recursion and recursive functions seem to many (including me) to be esoteric mysteries, understandable only to those elite few who are wired to think in a pretty unconventional way. We are taught from a young age that you can’t define a word by using that word, itself. To that idea, recursion says “watch me!”.
In explaining recursion, Sweigert is careful to begin by laying important groundwork. With adequately (but not overly) detailed and approachable explanations and examples, he discusses functions, their operation and features. He spends significant time explaining the call stack, what it does, how it is structured, and how it operates, leading to a discussion of ‘stack overflow’, one of the risks of using recursion. With that out of the way, he then devotes an entire chapter to comparing recursion and iteration, demonstrating that in the vast majority of cases, recursive functions simply aren’t necessary and in some cases perform worse than their iterative counterparts.
The ensuing chapters look at recursion in action, exploring several popular recursive algorithms and techniques. It is in these chapters where we begin to see where recursion is actually a good idea, where it is a good fit (and also where it is not). So, while recursion may be mostly unnecessary, it is absolutely tailor-made for certain functions. Among other things, Sweigert explores traversing tree structures and demonstrates how memoization (yes, I spelled that correctly) can improve the efficiency of some recursive functions. He provides a plethora of examples demonstrating each concept he explores. It is worth noting here that Sweigert provides code examples in both Python and JavaScript (where possible), making it a valuable resource for students of both. The book ends with several projects that build on the lessons that come before, including one that implements the very cool Droste Effect.
For the beginning and intermediate programmer, which is the only demographic to which I can relate, the real value of this book lies not only in its teaching about recursion. Its value also stems from its ability to stretch you just a little bit further, to make think just a little bit differently, to give you confidence that maybe lofty concepts that seem way above your head are within reach. Any book that can achieve that while simultaneously telling you that what you’re learning is mostly unnecessary is well worth the read.
--Reviewer was provided a review copy by the author
Top reviews from other countries
-
Smart AleckReviewed in Turkey on February 7, 20245.0 out of 5 stars Çok güzel bir kitap.Tavsiye ederim.
Format: PaperbackVerified PurchaseKitap bu konuda çok işime yaradı. Konu ile ilgililere şiddetle tavsiye ederim. Faydalı bir kitap akıcı ve anlaşılır. Pek çok şey öğreniyorsunuz. Tabi konu ile ilgili biriyseniz. Python ve Javascript programlama dillerinde intermediate seviyede birikiminiz olması gerektiğini önemle belirteyim. Intermediate seviyedeyseniz alın işe yarar. Baskısı gayet kaliteli ve rahat okunabilir punto büyüklüğü. Ucuza alacağım diye gidip fotokopi, fake kitaplara para vermeyin tavsiye etmem.
Ricardo DReviewed in Australia on May 7, 20235.0 out of 5 stars To understand recursion, one must first understand recursion.
Format: PaperbackVerified PurchaseThis book does a good job of it...
Vladimir NabokovReviewed in the United Kingdom on June 19, 20245.0 out of 5 stars Good insight
Format: PaperbackVerified PurchaseI bought this book as a companion to Elements of Programming Interviews in Python. Glad I did as it has helped my understanding of recursion a lot.
-
J. BachmannReviewed in Germany on November 5, 20255.0 out of 5 stars lesenswertes Buch
Format: PaperbackVerified PurchaseSehr gutes Buch, um Rekursion zu lernen wirklich lesenswert. Großartiger Autor.
-
Loki2018Reviewed in Germany on February 14, 20235.0 out of 5 stars Top
Format: KindleVerified PurchaseErfüllt seinen Zweck















