Learning JavaScript Data Structures and Algorithms, 2nd Edition cover

Learning JavaScript Data Structures and Algorithms, 2nd Edition

Rating 4.0
Word count
162K words
Chapters
1
Series
Turing Programming Series · Web Development
ISBN
9787115467539

Tags

Summary

This is the Chinese translation of the second edition of Learning JavaScript Data Structures and Algorithms, brought in by People's Posts and Telecommunications Press in its Turing Programming Series · Web Development series. The book runs about 217 pages and roughly 160,000 characters, and it is built around "implementing things by hand in JavaScript" rather than stopping at pseudocode and theoretical description. It begins with JavaScript language fundamentals—variables, operators, truthy and falsy values, equality operators, control structures, functions, and object-oriented programming—and introduces new features from ES6 and ES7 as well as three ways to set up a code runtime environment: the browser, XAMPP, and Node.js. It then builds classic data structures in turn: arrays, stacks, queues, linked lists (including doubly and circular linked lists), sets, dictionaries and hash tables, trees (binary search trees and AVL self-balancing trees), and graphs. It explains basic operations such as declaration, initialization, and adding or removing elements, and also demonstrates how to use these structures to solve problems such as converting decimal to binary, playing the drum-passing game, handling hash collisions, and in-order/pre-order/post-order tree traversal. The algorithms section is the book's focus: sorting covers bubble, selection, insertion, merge, quick, and heap sort as well as distributed sorts such as counting, bucket, and radix sort; searching includes sequential and binary search; the graph chapter goes deeper into breadth-first and depth-first traversal, Dijkstra and Floyd-Warshall shortest paths, and Prim and Kruskal minimum spanning trees; the final part discusses algorithm patterns such as recursion, dynamic programming, greedy algorithms, and functional programming, compares complexity using Big O notation, and briefly introduces NP-complete problems.

Editor's review

很多前端开发者写业务代码多年,却始终没把数据结构与算法真正“过一遍”,原因往往不是不想学,而是教材离 JavaScript 太远:例子是 C 或 Java 的,指针、数组边界、抽象类型全靠想象。这本书的价值就在于把整条学习路径都落在 JavaScript 上,代码直接可以复制到浏览器控制台或 Node.js 里跑,看到结果,再回头理解原理。 第二版相对初版补齐了 ES6/ES7 相关内容和更完整的算法体系:既有一条从数组、栈、队列、链表、集合、字典、散列表到树、图的清晰主线,也有排序、搜索、最短路径、最小生成树与动态规划、贪心算法这些面试和实际开发中反复出现的内容,最后用大 O 表示法收尾,帮助读者建立复杂度直觉。全书篇幅精炼,两百余页,读起来不像动辄七八百页的“大全”那样容易半途而废。 需要提醒的是,这一版基于较早的 ES 语法,示例多用 ES5 与部分 ES6 写法,某些章节(如集合、Map)在后面的第 3 版中还有扩充;如果只想速览算法思想,本书够用;若追求最新语法与更完整的工程实践,可再对照更新版本阅读。

Who it's for

A good fit for

  • 已掌握 JavaScript 基础语法、想系统补齐数据结构的前端开发者
  • 准备技术面试、需要用 JS 手写常见算法与复杂度分析的求职者
  • 计算机专业学生,希望换一种更直观的语言理解数据结构课程内容
  • 从其他语言转 JavaScript、想了解 JS 中如何实现经典结构的工程师

Not a good fit for

  • 完全没有编程基础的零起点读者,语言基础章节只作简要铺垫
  • 只想要纯理论、数学推导式算法教材的读者,本书偏重代码实现
  • 期待与最新 ES 规范完全同步示例的读者,本版语法停留在较早阶段

Reading tips

  1. 先读第1章搭好运行环境,后面每章代码都亲手敲一遍并打印中间结果,避免只看懂不动手。
  2. 把第2至9章当成“实现任务”:先自己写,再对照书中代码,重点关注边界条件与异常处理。
  3. 第10至12章建议配合刷题平台同步练习,每学一种排序或搜索就复盘其时间复杂度与适用场景。
  4. 读图与动态规划章节时可先画出示意图再写代码,用图示辅助理解遍历顺序和状态转移。

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. Turing Programming Series · Web Development

FAQ

这本书和《学习JavaScript数据结构与算法》第3版有什么区别?
第3版在2019年出版,篇幅增至约294页,新增双端队列、递归专章、二叉堆与堆排序、内插搜索、随机算法、分而治之和回溯算法等内容。第2版只有12章,内容更精炼,适合希望快速过一遍基础结构与算法的读者。
读这本书需要什么前置知识?
需要了解 JavaScript 基本语法,如变量、函数、条件与循环、对象和数组。书中第1章会回顾语言基础并介绍运行环境搭建,但不会从零讲解编程概念,没有编程经验建议先补基础。
书中的代码用什么方式运行?
书中介绍了三种方式:直接用 Chrome 或 Firefox 浏览器控制台、借助 XAMPP 搭建 Web 服务器、或用 Node.js 配合 http-server。示例大多是独立可运行的,不需要复杂工程配置。
学完这本书能达到什么水平?
能独立用 JavaScript 实现常见数据结构与排序、搜索算法,看懂大 O 表示法并评估算法效率,理解动态规划、贪心等算法模式的基本思路,足以应对多数前端面试中的算法题目,但仍需大量练习巩固。
本书适合作为算法竞赛入门吗?
不太适合。本书面向 Web 开发者与初学者,重点是理解数据结构和经典算法在 JavaScript 中的实现,不涉及竞赛常用的高强度技巧训练和特定判题环境,竞赛方向建议另选专项教材。

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.

More by the same author

Top rated in the same category