The Recursive Book of Recursion: Ace the Coding Interview with Python and JavaScript (Paperback)

Sweigart, Al

買這商品的人也買了...

商品描述

An accessible yet rigorous crash course on recursive programming using Python and JavaScript examples.

Recursion, and recursive algorithms, have a reputation for being intimidating. They're seen as an advanced computer science topic often brought up in coding interviews. Moreover, coders often perceive the use of a recursive algorithm as a sophisticated solution that only true programmers can produce. But there's nothing magical about recursion. Its fearsome reputation is more a product of poor teaching than of the complexity of recursion itself.

This book teaches the basics of recursion, exposes the ways it's often poorly taught, and clarifies the fundamental principles behind all recursive algorithms. It is project-based, containing complete, runnable programs in both Python and JavaScript, and covers several common recursive algorithms for tasks like calculating factorials, producing numbers in the Fibonacci sequence, tree traversal, maze solving, binary search, quicksort and merge sort, Karatsuba multiplication, permutations and combinations, and solving the eight queens problem.

The book also explains tail call optimization and memoization, concepts often employed to produce effective recursive algorithms, and the call stack, which is a critical part of how recursive functions work but is almost never explicitly pointed out in lessons on recursion. The last chapter, on fractals, culminates with examples of the beautiful fractal shapes recursion can produce.

商品描述(中文翻譯)

一本易於理解但嚴謹的遞迴程式設計入門書,使用Python和JavaScript示例。

遞迴和遞迴算法常被視為令人生畏的主題。它們被認為是高級計算機科學話題,常在編程面試中提及。此外,編程人員通常認為使用遞迴算法是一種只有真正的程序員才能產生的複雜解決方案。但遞迴並沒有什麼神奇之處。它可怕的聲譽更多是由於教學不佳,而不是遞迴本身的複雜性。

本書教授遞迴的基礎知識,揭示了常見的遞迴教學不當之處,並澄清了所有遞迴算法背後的基本原則。本書以項目為基礎,包含Python和JavaScript的完整可運行程式,並涵蓋了幾種常見的遞迴算法,如計算階乘、生成費波那契數列中的數字、樹的遍歷、迷宮解決、二分搜索、快速排序和合併排序、Karatsuba乘法、排列組合以及解決八皇后問題。

本書還解釋了尾遞迴優化和記憶化,這些概念常用於生成有效的遞迴算法,以及調用堆疊,這是遞迴函數工作的關鍵部分,但在遞迴教學中幾乎從未明確指出。最後一章關於分形,展示了遞迴可以生成的美麗分形形狀的示例。

作者簡介

Al Sweigart is a software developer and tech book author living in Houston. Python is his favorite programming language, and he is the developer of several open source modules for it. His other books are freely available under a Creative Commons license on his website at https: //www.inventwithpython.com/.

作者簡介(中文翻譯)

Al Sweigart是一位居住在休士頓的軟體開發者和技術書籍作者。Python是他最喜歡的程式語言,他也是幾個Python開源模組的開發者。他的其他書籍可以在他的網站https://www.inventwithpython.com/上免費取得,並且採用創用CC授權。