Python Algorithms cover

Python Algorithms

Rating 3.9
Word count
497K words
Chapters
15
ISBN
9787115404831

Tags

Summary

Python Algorithms is an introduction to algorithm design and analysis written by Magnus Lie Hetland, an associate professor at the Norwegian University of Science and Technology, for readers with some grounding in Python. The Chinese edition, translated by Ling Jie, Lu Yuchun, and Gu Jun from the 2014 second edition of the English original (Python Algorithms: Mastering Basic Algorithms in the Python Language), was published by Posts & Telecom Press in 2016. The book has 11 chapters and uses Python code as its main illustrative language, presenting algorithm theory, complexity analysis, and runnable implementations together: starting from asymptotics and the representation of graphs and trees, it goes on to discuss solving summations and recurrences, induction and recursive reduction, traversal (BFS/DFS and their variants), divide and conquer (decompose—merge—solve), proving the correctness of greedy algorithms, complex dependencies and memoization in dynamic programming, single-source shortest paths as represented by Dijkstra, matching and cut problems in network flow, and finally NP-hard problems and strategies of "limited dilution" for dealing with them. Each chapter ends with exercises and further reading, and the book closes with hints for the exercises plus appendices on speeding up Python, some famous problems and algorithms, graph theory basics, and exercise hints. The book does not aim to enumerate algorithms exhaustively but emphasizes "how to think about an algorithmic problem" and the cultivation of complexity intuition; it is suitable as a supplementary reference for university algorithm courses and for programmers filling gaps through self-study.

Editor's review

市面上的算法书大多以 C++ 或伪代码为主语,Python 使用者往往要自己在两种语汇之间来回翻译。这本《Python算法教程》的好处,是把「算法思想」和「Python 实现」放在同一页上:邻接表与邻接矩阵怎么用 Python 的 dict、list 和 set 搭出来,递归与记忆化怎么写才不会被栈深和重复子问题拖垮,书中都给出了可直接运行的小段代码。 它的重点不在刷题清单,而在建立复杂度直觉。作者先从求和式、递归式和主定理讲起,再一路走到遍历、分治、贪心、动态规划和图算法,每引入一种范式,都先把「为什么这样拆」讲清楚,然后才落到代码;贪心一章甚至把「贪心有理吗?请证明」直接写进标题,提醒读者别只凭感觉。 这本书不适合零基础读者,也不适合只想背模板应付面试的人。但如果你已能用 Python 写程序,却总觉得算法是「另一门语言」,或者想补上一堂比 MOOC 更系统的算法课,它是一本扎实、少废话的自学导读。每章末的练习与参考资料,足够你把它当作一学期的阅读计划来用。

Who it's for

A good fit for

  • 已掌握 Python 基本语法、想系统补算法与复杂度分析的开发者
  • 计算机专业学生,作为数据结构与算法课程的辅助参考书
  • 准备技术面试、需要理解贪心、动态规划与图算法原理的人
  • 喜欢边读边敲代码、用可运行示例验证算法思路的自学者

Not a good fit for

  • 完全没有编程基础的入门读者,书中不介绍 Python 语法
  • 只想背面试模板、不愿自己写证明与练习的速成者
  • 专攻竞赛、需要高难度算法技巧与题解汇编的读者

Reading tips

  1. 先快速过一遍第1、2章,把渐近记法和图、树表示法这两块底子打牢,再进入后续章节。
  2. 建议对照书中代码在本地实现一遍,尤其第5至第9章的遍历、分治、贪心、记忆化和 Dijkstra,动手比阅读收益更大。
  3. 每章末的练习题至少完成一半,遇到卡壳先看书末附录 D 的习题提示,再回头看正文推导。
  4. 阅读第11章时不必强求证明,重点理解 NP 困难问题的判定思路与常见近似、启发式应对策略。

About the publisher

Posts & Telecom Press China · Founded in 1953

Posts & Telecom Press is known for its strengths in science and technology, computing, and information and communications titles, and has extended its publishing into photography, art, software learning, and inspirational growth, giving it a fairly diverse range. Its catalog includes computing and communications works such as Refactoring and Patterns (Revised Edition) and Huawei Switch Learning Guide (Second Edition), alongside bilingual collector's editions such as The Little Prince (Chinese-English-French illustrated collector's edition), The Great Gatsby, and Three Days to See. Beijing Ten Years: 1980-1990 and Ghost Blade: WLOP Personal Illustration Collection reflect its presence in photography and art. Its authors include Antoine de Saint-Exupéry, Helen Keller, Joshua Kerievsky, Wang Da, Zhang Zhaozeng, and WLOP.

Contents

  1. Chapter 1 Introduction
  2. Chapter 2 Basics
  3. Chapter 3 Counting 101
  4. Chapter 4 Induction, Recursion, and Reduction
  5. Chapter 5 Traversal: The Skeleton Key of Algorithmics
  6. Chapter 6 Divide, Combine, and Conquer
  7. Chapter 7 Greed Is Good? Prove It!
  8. Chapter 8 Tangled Dependencies and Memoization
  9. Chapter 9 From A to B with Dijkstra and Friends
  10. Chapter 10 Matching, Cuts, and Flows
  11. Chapter 11 Hard Problems and (Limited) Sloppiness
  12. Appendix A Pedal to the Metal: Speeding Up Python
  13. Appendix B Some Famous Problems and Algorithms
  14. Appendix C Graph Theory Basics
  15. Appendix D Hints for Exercises

FAQ

这本书适合零基础学 Python 的人吗?
不太适合。书中默认读者已能用 Python 写程序,不介绍语法基础,重点是算法分析与实现。建议先读完《Python编程:从入门到实践》或《Python基础教程》,再来看这本,否则容易被递归式和图算法的代码卡住。
中文版对应英文原著的哪一版?
据图书馆编目信息,中文版是依据 2014 年出版的英文原著第 2 版(Python Algorithms: Mastering Basic Algorithms in the Python Language)译出的,由 Apress 授权人民邮电出版社出版。
书里的代码用 Python 2 还是 Python 3?
原著第 2 版以 Python 3 为主,示例代码在 Python 3 下即可运行。少数涉及标准库细节的片段可能因 Python 版本更新而需微调,动手时注意检查导入模块与语法。
这本书和《算法导论》《数据结构与算法:Python语言实现》有什么区别?
《算法导论》侧重形式化证明与伪代码,体量大、偏理论;本书以 Python 代码为示例,篇幅与难度更轻,重理解与实现。与同用 Python 的《数据结构与算法:Python语言实现》相比,本书对数据结构的铺陈较少,更聚焦算法范式与图算法。
读完能达到什么水平?
可以掌握常见复杂度分析、递归与主定理、遍历、分治、贪心、动态规划与最短路、网络流等核心内容,能读懂大多数算法文献的伪代码并自己动手实现,但距离竞赛级算法训练还有差距。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

Top rated in the same category