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

@@ -6,14 +6,14 @@
#include "../include/include.hpp"
/* 在链表的点 n0 之后插入点 P */
/* 在链表的点 n0 之后插入点 P */
void insert(ListNode* n0, ListNode* P) {
ListNode* n1 = n0->next;
P->next = n1;
n0->next = P;
}
/* 删除链表的点 n0 之后的首个点 */
/* 删除链表的点 n0 之后的首个点 */
void remove(ListNode* n0) {
if (n0->next == nullptr)
return;
@@ -25,7 +25,7 @@ void remove(ListNode* n0) {
delete P;
}
/* 访问链表中索引为 index 的点 */
/* 访问链表中索引为 index 的点 */
ListNode* access(ListNode* head, int index) {
for (int i = 0; i < index; i++) {
if (head == nullptr)
@@ -35,7 +35,7 @@ ListNode* access(ListNode* head, int index) {
return head;
}
/* 在链表中查找值为 target 的首个点 */
/* 在链表中查找值为 target 的首个点 */
int find(ListNode* head, int target) {
int index = 0;
while (head != nullptr) {
@@ -51,7 +51,7 @@ int find(ListNode* head, int target) {
/* Driver Code */
int main() {
/* 初始化链表 */
// 初始化各个
// 初始化各个
ListNode* n0 = new ListNode(1);
ListNode* n1 = new ListNode(3);
ListNode* n2 = new ListNode(2);
@@ -65,23 +65,23 @@ int main() {
cout << "初始化的链表为" << endl;
PrintUtil::printLinkedList(n0);
/* 插入点 */
/* 插入点 */
insert(n0, new ListNode(0));
cout << "插入点后的链表为" << endl;
cout << "插入点后的链表为" << endl;
PrintUtil::printLinkedList(n0);
/* 删除点 */
/* 删除点 */
remove(n0);
cout << "删除点后的链表为" << endl;
cout << "删除点后的链表为" << endl;
PrintUtil::printLinkedList(n0);
/* 访问点 */
/* 访问点 */
ListNode* node = access(n0, 3);
cout << "链表中索引 3 处的点的值 = " << node->val << endl;
cout << "链表中索引 3 处的点的值 = " << node->val << endl;
/* 查找点 */
/* 查找点 */
int index = find(n0, 2);
cout << "链表中值为 2 的点的索引 = " << index << endl;
cout << "链表中值为 2 的点的索引 = " << index << endl;
// 释放内存
freeMemoryLinkedList(n0);