refactor: Replace 结点 with 节点 (#452)

* Replace 结点 with 节点
Update the footnotes in the figures

* Update mindmap

* Reduce the size of the mindmap.png
This commit is contained in:
Yudong Jin
2023-04-09 04:32:17 +08:00
committed by GitHub
parent 3f4e32b2b0
commit 1c8b7ef559
395 changed files with 2056 additions and 2056 deletions

View File

@ -4,11 +4,11 @@
* Author: Zhuo Qinyue (1403450829@qq.com)
*/
/* 双向链表点 */
/* 双向链表点 */
class ListNode {
prev; // 前驱点引用 (指针)
next; // 后继点引用 (指针)
val; // 点值
prev; // 前驱点引用 (指针)
next; // 后继点引用 (指针)
val; // 点值
constructor(val) {
this.val = val;
@ -19,8 +19,8 @@ class ListNode {
/* 基于双向链表实现的双向队列 */
class LinkedListDeque {
#front; // 头点 front
#rear; // 尾点 rear
#front; // 头点 front
#rear; // 尾点 rear
#queSize; // 双向队列的长度
constructor() {
@ -40,7 +40,7 @@ class LinkedListDeque {
// 将 node 添加至链表尾部
this.#rear.next = node;
node.prev = this.#rear;
this.#rear = node; // 更新尾
this.#rear = node; // 更新尾
}
this.#queSize++;
}
@ -56,7 +56,7 @@ class LinkedListDeque {
// 将 node 添加至链表头部
this.#front.prev = node;
node.next = this.#front;
this.#front = node; // 更新头
this.#front = node; // 更新头
}
this.#queSize++;
}
@ -66,14 +66,14 @@ class LinkedListDeque {
if (this.#queSize === 0) {
return null;
}
const value = this.#rear.val; // 存储尾点值
// 删除尾
const value = this.#rear.val; // 存储尾点值
// 删除尾
let temp = this.#rear.prev;
if (temp !== null) {
temp.next = null;
this.#rear.prev = null;
}
this.#rear = temp; // 更新尾
this.#rear = temp; // 更新尾
this.#queSize--;
return value;
}
@ -83,14 +83,14 @@ class LinkedListDeque {
if (this.#queSize === 0) {
return null;
}
const value = this.#front.val; // 存储尾点值
// 删除头
const value = this.#front.val; // 存储尾点值
// 删除头
let temp = this.#front.next;
if (temp !== null) {
temp.prev = null;
this.#front.next = null;
}
this.#front = temp; // 更新头
this.#front = temp; // 更新头
this.#queSize--;
return value;
}

View File

@ -8,8 +8,8 @@ const { ListNode } = require("../modules/ListNode");
/* 基于链表实现的队列 */
class LinkedListQueue {
#front; // 头点 #front
#rear; // 尾点 #rear
#front; // 头点 #front
#rear; // 尾点 #rear
#queSize = 0;
constructor() {
@ -29,13 +29,13 @@ class LinkedListQueue {
/* 入队 */
push(num) {
// 尾点后添加 num
// 尾点后添加 num
const node = new ListNode(num);
// 如果队列为空,则令头、尾点都指向该
// 如果队列为空,则令头、尾点都指向该
if (!this.#front) {
this.#front = node;
this.#rear = node;
// 如果队列不为空,则将该点添加到尾点后
// 如果队列不为空,则将该点添加到尾点后
} else {
this.#rear.next = node;
this.#rear = node;
@ -46,7 +46,7 @@ class LinkedListQueue {
/* 出队 */
pop() {
const num = this.peek();
// 删除头
// 删除头
this.#front = this.#front.next;
this.#queSize--;
return num;

View File

@ -8,7 +8,7 @@ const { ListNode } = require("../modules/ListNode");
/* 基于链表实现的栈 */
class LinkedListStack {
#stackPeek; // 将头点作为栈顶
#stackPeek; // 将头点作为栈顶
#stkSize = 0; // 栈的长度
constructor() {