Share E-Book
Scan to open this page

Scan with your phone to open this page

Author: [巴西]格罗纳(LoianeGroner), 孙晓博, 邓钢, 吴双, 陈迪, 袁源

本书首先介绍了JavaScript语言的基础知识,接下来讨论了数组、栈、队列、链表、集合、字典、散列表、树、图等数据结构,之后探讨了各种排序和搜索算法,包括冒泡排序、选择排序、插入排序、归并排序、快速排序、顺序搜索、二分搜索,还介绍了动态规划和贪心算法等常用的高级算法及相关知识。

AI Reading Assistant

Whole-book reading guide from stratified index samples; jump to passages in the text

AI guide
【One-Line Pitch】 A hands-on, code-first introduction to JavaScript data structures and algorithms, ideal for front-end developers and CS students who want to build a solid foundation in both language features and classic problem-solving techniques. 【Book Arc】 - **Opening (~0%–11%)**: Sets up the JavaScript environment (Node.js, http-server) and reviews core language basics—variables, functions, and scope—so readers can run and understand the examples that follow. - **Early (~11%–25%)**: Covers ECMAScript 2015+ features (classes, inheritance, modules, iterators) and then dives into arrays, including insertion, iteration, multidimensional arrays, and typed arrays, establishing the fundamental data container used throughout. - **Early–Middle (~25%–39%)**: Introduces stack and queue implementations (both array-based and object-based), then moves to linked lists—singly, doubly, and circular—with a focus on pointer manipulation and common operations like insertion and removal. - **Middle (~39%–50%)**: Explores non-sequential data structures: sets (with union, intersection, difference, subset operations), dictionaries, and hash tables, explaining how hashing enables fast value retrieval. - **Late (~50%–75%)**: Covers trees and graphs (per the table of contents), then sorting algorithms (bubble, selection, insertion, merge, quick, counting, bucket, radix) and search algorithms (sequential, binary, interpolation), plus randomized algorithms. - **Ending (~75%–100%)**: Moves to algorithm design techniques—divide and conquer, dynamic programming, greedy algorithms, and backtracking—and concludes with big O notation, complexity analysis, and an introduction to functional programming in JavaScript. 【Key Takeaways】 - **JavaScript fundamentals are the prerequisite** (Early): Understanding variables, scope, and functions is essential before tackling any data structure; the book assumes you can run code via Node.js or a browser console. - **ECMAScript 2015+ syntax modernizes the code** (Early): Classes, inheritance, modules, and iterators are used throughout, so familiarity with `let`/`const`, `class`, and `import`/`export` is necessary to follow the implementations. - **Arrays are the workhorse container** (Early): Mastery of array methods—insertion, deletion, iteration, `entries`/`keys`/`values`, and `toString`/`join`—pays off because many later structures build on array logic. - **Stacks and queues enforce discipline** (Early–Middle): LIFO and FIFO principles are implemented both with arrays and with objects, and practical problems (e.g., decimal-to-binary conversion, hot potato game) show real-world applications. - **Linked lists trade access for flexibility** (Middle): Unlike arrays, adding or removing elements doesn’t require shifting others, but you must manage pointers carefully; doubly and circular variants add backward and wrap-around navigation. - **Sets and dictionaries organize key-value data** (Middle): Implementing set operations (union, intersection, difference) and dictionary methods (get, remove, keys) teaches how to structure non-sequential data efficiently. - **Hash tables enable fast lookup** (Middle): A hash function maps keys to table positions, making retrieval near-instant; the book explains common hash functions and their trade-offs. - **Sorting and searching are algorithm foundations** (Late): From simple bubble sort to efficient quicksort and binary search, each algorithm is implemented step-by-step, with complexity trade-offs discussed. - **Advanced techniques solve complex problems** (Ending): Dynamic programming, greedy algorithms, and backtracking are applied to classic problems (coin change, knapsack, maze solving, sudoku), showing how to choose the right strategy. 【Reading Tips】 - **Skim the first two chapters** if you already know JavaScript basics and ES2015+; focus instead on the data structure chapters (3–10) where the core value lies. - **Deep-read the stack and linked list chapters**—they introduce the object-based implementation pattern and pointer manipulation that recur in later structures like trees and graphs. - **Run every code example** as you read; the book is code-heavy, and typing out the implementations (especially for hash tables and sorting) solidifies understanding far better than passive reading. - **Pay extra attention to the algorithm design chapter** (14) and the complexity chapter (15); these are the most conceptually dense and will help you evaluate when to use each algorithm. - **Use the companion GitHub repository** for full source code; the book sometimes omits complete implementations (e.g., some doubly linked list methods), so the repo fills in the gaps. 【Coverage Limits】 This guide covers the book’s structure and key topics from the provided excerpts, which span roughly the first half of the book (through hash tables). Details on trees, graphs, and the later algorithm chapters are inferred from the table of contents and may not reflect the full depth of those sections.
Excerpt 1
5.3 JavaScript 函数式工具 13.2.1 顺序搜索 ................................ 257 箱——map、filter 13.2.2 二分搜索 ................................ 258 和 reduce ..................
View in text
Excerpt 2
ort * as area from './17-CalcArea.mjs'; import Book from './17-Book.mjs'; 8 我们将在 node 命令后添加--experimental-modules 来执行代码,如下所示。 cd 17-ES2015-Modules-node 9 nod...
View in text
Excerpt 3
进制的数字,过程大概是如下这样。 2 3 4 大学的计算机课一般都会先教这个进制转换。下面是对应的算法描述。 5 图灵社区会员 道法小自然(903567778@qq.com) 专享 尊重版权 5.1 队列数据结构 85 4. 检查队列是否为空并获取它的长度 1 下一个是 isEmpty 方法。如果队列为空,它会返...
View in text
Excerpt 4
.items) { // {1} if(this.items.hasOwnProperty(key)) { values.push(key); // {2} } } return values; 首先迭代 items 对象的所有属性(行{1}),把它们添加到一个数组中(行{2}),并返回这 个数组。该方法类似于我...
View in text
Excerpt 5
actorial 的调用。 我们也可以在函数开头添加 console.trace()来在浏览器的控制台中查看结果。 function factorial(n) { console.trace(); // 函数逻辑 } 当 factorial(3)被调用时,我们能在控制台中得到下面的结果。 factorial @...
View in text
Excerpt 6
67778@qq.com) 专享 尊重版权 12.3 创建 Graph 类 217 这个方法接收顶点 v 作为参数。只有在这个顶点不存在于图中时(行{5})我们将该顶点添加 1 到顶点列表中(行{6}),并且在邻接表中,设置顶点 v 作为键对应的字典值为一个空数组(行{7})。 现在,我们来实现 addEdge...
View in text
Excerpt 7
[j])并将每个元素加入排序后的数组。 下图展现了桶排序算法的过程。 5 6 7 8 9 0 13.1.8 基数排序 1 基数排序也是一个分布式排序算法,它根据数字的有效位或基数(这也是它为什么叫基数排 序)将整数分布到桶中。基数是基于数组中值的记数制的。 2 比如,对于十进制数,使用的基数是 10。因此,算法将...
View in text
Excerpt 8
derscorejs.org/ Bilby.js:http://bilby.brianmckenna.org/ Lazy.js:http://danieltao.com/lazy.js/ Bacon.js:https://baconjs.github.io/ Fn.js:http://eliperelman.co...
View in text
Tags
AI categories
ProgrammingJavaScriptAlgorithm
ISBN: 7115510172
Publish Year: 2019
Language: Chinese
Pages: 314
File Format: PDF
File Size: 13.6 MB
Text Preview (First 20 pages)
Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

Generating text preview…