mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-13 12:20:57 +00:00
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:
@@ -19,7 +19,7 @@ func hashingSearchArray(m map[int]int, target int) int {
|
||||
|
||||
/* 哈希查找(链表) */
|
||||
func hashingSearchLinkedList(m map[int]*ListNode, target int) *ListNode {
|
||||
// 哈希表的 key: 目标结点值,value: 结点对象
|
||||
// 哈希表的 key: 目标节点值,value: 节点对象
|
||||
// 若哈希表中无此 key ,返回 nil
|
||||
if node, ok := m[target]; ok {
|
||||
return node
|
||||
|
||||
@@ -32,5 +32,5 @@ func TestHashingSearch(t *testing.T) {
|
||||
head = head.Next
|
||||
}
|
||||
node := hashingSearchLinkedList(m1, target)
|
||||
fmt.Println("目标结点值 3 的对应结点对象为 ", node)
|
||||
fmt.Println("目标节点值 3 的对应节点对象为 ", node)
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func linearSearchArray(nums []int, target int) int {
|
||||
func linearSearchLinkedList(node *ListNode, target int) *ListNode {
|
||||
// 遍历链表
|
||||
for node != nil {
|
||||
// 找到目标结点,返回之
|
||||
// 找到目标节点,返回之
|
||||
if node.Val == target {
|
||||
return node
|
||||
}
|
||||
|
||||
@@ -22,5 +22,5 @@ func TestLinearSearch(t *testing.T) {
|
||||
// 在链表中执行线性查找
|
||||
head := ArrayToLinkedList(nums)
|
||||
node := linearSearchLinkedList(head, target)
|
||||
fmt.Println("目标结点值 3 的对应结点对象为", node)
|
||||
fmt.Println("目标节点值 3 的对应节点对象为", node)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user