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,19 +4,19 @@
* Author: liuyuxin (gvenusleo@gmail.com)
*/
/* 双向链表点 */
/* 双向链表点 */
class ListNode {
int val; // 点值
ListNode? next; // 后继点引用(指针)
ListNode? prev; // 前驱点引用(指针)
int val; // 点值
ListNode? next; // 后继点引用(指针)
ListNode? prev; // 前驱点引用(指针)
ListNode(this.val, {this.next, this.prev});
}
/* 基于双向链表实现的双向对列 */
class LinkedListDeque {
late ListNode? _front; // 头点 _front
late ListNode? _rear; // 尾点 _rear
late ListNode? _front; // 头点 _front
late ListNode? _rear; // 尾点 _rear
int _queSize = 0; // 双向队列的长度
LinkedListDeque() {
@@ -45,13 +45,13 @@ class LinkedListDeque {
// 将 node 添加至链表头部
_front!.prev = node;
node.next = _front;
_front = node; // 更新头
_front = node; // 更新头
} else {
// 队尾入队操作
// 将 node 添加至链表尾部
_rear!.next = node;
node.prev = _rear;
_rear = node; // 更新尾
_rear = node; // 更新尾
}
_queSize++; // 更新队列长度
}
@@ -75,24 +75,24 @@ class LinkedListDeque {
final int val;
if (isFront) {
// 队首出队操作
val = _front!.val; // 暂存头点值
// 删除头
val = _front!.val; // 暂存头点值
// 删除头
ListNode? fNext = _front!.next;
if (fNext != null) {
fNext.prev = null;
_front!.next = null;
}
_front = fNext; // 更新头
_front = fNext; // 更新头
} else {
// 队尾出队操作
val = _rear!.val; // 暂存尾点值
// 删除尾
val = _rear!.val; // 暂存尾点值
// 删除尾
ListNode? rPrev = _rear!.prev;
if (rPrev != null) {
rPrev.next = null;
_rear!.prev = null;
}
_rear = rPrev; // 更新尾
_rear = rPrev; // 更新尾
}
_queSize--; // 更新队列长度
return val;

View File

@@ -8,8 +8,8 @@ import '../utils/list_node.dart';
/* 基于链表实现的队列 */
class LinkedListQueue {
ListNode? _front; // 头点 _front
ListNode? _rear; // 尾点 _rear
ListNode? _front; // 头点 _front
ListNode? _rear; // 尾点 _rear
int _queSize = 0; // 队列长度
LinkedListQueue() {
@@ -29,14 +29,14 @@ class LinkedListQueue {
/* 入队 */
void push(int num) {
// 尾点后添加 num
// 尾点后添加 num
final node = ListNode(num);
// 如果队列为空,则令头、尾点都指向该
// 如果队列为空,则令头、尾点都指向该
if (_front == null) {
_front = node;
_rear = node;
} else {
// 如果队列不为空,则将该点添加到尾点后
// 如果队列不为空,则将该点添加到尾点后
_rear!.next = node;
_rear = node;
}
@@ -46,7 +46,7 @@ class LinkedListQueue {
/* 出队 */
int pop() {
final int num = peek();
// 删除头
// 删除头
_front = _front!.next;
_queSize--;
return num;

View File

@@ -8,7 +8,7 @@ import '../utils/list_node.dart';
/* 基于链表类实现的栈 */
class LinkedListStack {
ListNode? _stackPeek; // 将头点作为栈顶
ListNode? _stackPeek; // 将头点作为栈顶
int _stkSize = 0; // 栈的长度
LinkedListStack() {