Data Structures and Algorithms with JavaScript cover

Data Structures and Algorithms with JavaScript

Rating 3.3
Chapters
1
Series
A JavaScript-Based Introduction to Data Structures and Algorithms
ISBN
9787115363398

Tags

Summary

This is an introductory book on data structures and algorithms built around JavaScript, translated from Data Structures and Algorithms with JavaScript published by O'Reilly. The author, Michael McMillan, is both a university instructor and a programmer. The book centers on JavaScript's language characteristics—"arrays are objects, global variables are everywhere, and there is a prototype-based object model"—and discusses how to implement the data structures and algorithms common in traditional programming languages (such as C++ and Java) in this environment, while pointing out how to weigh performance against implementation. The book has 14 chapters. Chapter 1 lays out JavaScript's programming environment and language model, including variable declarations, arithmetic and math functions, conditional and loop structures, functions, variable scope, recursion, and objects and object-oriented programming, establishing a unified code foundation for later chapters. Chapter 2 begins the main treatment of data structures: it first covers the most commonly used arrays, including accessor functions, mutator functions, iterator methods, two-dimensional and multidimensional arrays, and arrays of objects; it then implements, in turn, lists, stacks, queues, linked lists (including doubly linked lists and circular linked lists), dictionaries, hashing (including open chaining and linear probing for collision handling), sets, binary trees and binary search trees, and graphs and graph algorithms (depth-first, breadth-first, shortest path, topological sorting). The final three chapters focus on algorithms: Chapter 12 compares the three basic sorts—bubble, selection, and insertion—with the three advanced sorts—Shell, merge, and quick—on a unified array test platform; Chapter 13 covers sequential search, binary search, and self-organizing data; Chapter 14 introduces dynamic programming (Fibonacci numbers, longest common substring, knapsack problem) and greedy algorithms (the coin-changing problem and the greedy solution to the knapsack problem). Each chapter ends with exercises so readers can implement as they read.

Editor's review

如果你是从前端转向计算机基础的「跨界」程序员,这本书的价值在于它不假定你学过 C 或 Java。作者把栈、队列、链表、散列、树、图这些教科书里的经典结构,全部用你每天在写的 JavaScript 重新实现一遍,代码短小、可直接运行,读起来没有语言迁移的额外负担。 全书结构清晰得像一条流水线:先补语言基础,再按线性结构、非线性结构、排序查找、高级算法的顺序推进,每章末尾都有练习题。第 12 章用统一的测试平台横向比较各种排序算法的实际耗时,第 8 章讨论散列碰撞的两种经典处理方式,这些内容对理解「为什么这样写更快」很有帮助。 需要提醒的是,本书篇幅不大,定位是入门引路而非深入剖析,对复杂度的理论推导着墨有限,代码也基于较早的 ECMAScript 版本。它更适合作为「第一次用 JavaScript 把数据结构写出来」的动手读物,配合更系统的算法教材一起使用效果更好。

Who it's for

A good fit for

  • 有 JavaScript 基础、想补计算机基础的前端开发者
  • 跨专业转行、没在学校系统学过数据结构与算法的程序员
  • 准备面试、需要亲手实现常见数据结构的求职者
  • 希望用熟悉语言理解算法原理的自学读者

Not a good fit for

  • 已系统学过数据结构与算法、想深入复杂度证明的读者
  • 需要 ES6+ 现代写法与 TypeScript 版本的开发者
  • 只想查阅现成代码库、不愿动手敲示例的读者

Reading tips

  1. 先通读第 1 章对齐语言基础,之后每章边读边把示例代码亲手敲一遍并运行。
  2. 把各章末尾的练习题当作检验标准,做不出来再回头重读该章实现部分。
  3. 读第 12、13 章时自己改测试数据规模,观察不同排序与查找方式的耗时差异。
  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

FAQ

这本书和《学习JavaScript数据结构与算法》有什么区别?
两者不是同一本书。本书作者是 Michael McMillan,2014 年由图灵引进,篇幅约 200 页,偏重逐个实现经典结构;《学习JavaScript数据结构与算法》作者是巴西的 Loiane Groner,内容更贴近现代 ES6+ 语法,页数与章节也更多,可按需选择。
需要什么基础才能读懂?
会写基本的 JavaScript 即可。第 1 章会复习变量、函数、作用域、递归和面向对象,因此不要求有 C 或 Java 背景,但最好能独立写出简单的函数和循环。
书中的代码能在 Node.js 里运行吗?
可以。书中示例以纯 JavaScript 实现为主,在 Node.js 或浏览器控制台中都能运行;个别章节涉及读取文本文件,在 Node.js 环境下更便于测试。
这本书适合当算法面试的唯一教材吗?
不太适合。它覆盖面偏基础,对复杂度推导和大量变式题型着墨有限。建议作为动手入门的第一本,再配合专门的算法教材与题库练习。
书里的内容会不会太旧?
书中代码基于较早的 ECMAScript 版本,没有涉及 ES6 的 class、Map、Set 等新语法。数据结构和算法的原理不会过时,但实际项目里可对照现代语法自行改写。

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