Update linear_search and hashing_search.

This commit is contained in:
Yudong Jin
2023-02-04 23:49:37 +08:00
parent 62114ce79a
commit f14e3e4c57
22 changed files with 95 additions and 92 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ import (
)
/* 线性查找(数组) */
func linerSearchArray(nums []int, target int) int {
func linearSearchArray(nums []int, target int) int {
// 遍历数组
for i := 0; i < len(nums); i++ {
// 找到目标元素,返回其索引
@@ -22,7 +22,7 @@ func linerSearchArray(nums []int, target int) int {
}
/* 线性查找(链表) */
func linerSearchLinkedList(node *ListNode, target int) *ListNode {
func linearSearchLinkedList(node *ListNode, target int) *ListNode {
// 遍历链表
for node != nil {
// 找到目标元素,返回其索引