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
@@ -8,14 +8,14 @@ import (
. "github.com/krahets/hello-algo/pkg"
)
/* 在链表的点 n0 之后插入点 P */
/* 在链表的点 n0 之后插入点 P */
func insertNode(n0 *ListNode, P *ListNode) {
n1 := n0.Next
P.Next = n1
n0.Next = P
}
/* 删除链表的点 n0 之后的首个点 */
/* 删除链表的点 n0 之后的首个点 */
func removeNode(n0 *ListNode) {
if n0.Next == nil {
return
@@ -26,7 +26,7 @@ func removeNode(n0 *ListNode) {
n0.Next = n1
}
/* 访问链表中索引为 index 的点 */
/* 访问链表中索引为 index 的点 */
func access(head *ListNode, index int) *ListNode {
for i := 0; i < index; i++ {
if head == nil {
@@ -37,7 +37,7 @@ func access(head *ListNode, index int) *ListNode {
return head
}
/* 在链表中查找值为 target 的首个点 */
/* 在链表中查找值为 target 的首个点 */
func findNode(head *ListNode, target int) int {
index := 0
for head != nil {
@@ -13,7 +13,7 @@ import (
func TestLinkedList(t *testing.T) {
/* 初始化链表 1 -> 3 -> 2 -> 5 -> 4 */
// 初始化各个
// 初始化各个
n0 := NewListNode(1)
n1 := NewListNode(3)
n2 := NewListNode(2)
@@ -28,21 +28,21 @@ func TestLinkedList(t *testing.T) {
fmt.Println("初始化的链表为")
PrintLinkedList(n0)
/* 插入点 */
/* 插入点 */
insertNode(n0, NewListNode(0))
fmt.Println("插入点后的链表为")
fmt.Println("插入点后的链表为")
PrintLinkedList(n0)
/* 删除点 */
/* 删除点 */
removeNode(n0)
fmt.Println("删除点后的链表为")
fmt.Println("删除点后的链表为")
PrintLinkedList(n0)
/* 访问点 */
/* 访问点 */
node := access(n0, 3)
fmt.Println("链表中索引 3 处的点的值 =", node)
fmt.Println("链表中索引 3 处的点的值 =", node)
/* 查找点 */
/* 查找点 */
index := findNode(n0, 2)
fmt.Println("链表中值为 2 的点的索引 =", index)
fmt.Println("链表中值为 2 的点的索引 =", index)
}