fix(go): fix support basic pkg

This commit is contained in:
reanon 2022-11-26 01:17:48 +08:00
parent 07a359484b
commit aa7a32efe0
3 changed files with 4 additions and 4 deletions

View file

@ -18,7 +18,7 @@ func TestLinearSearch(t *testing.T) {
t.Log("目标元素 3 的索引 = ", index) t.Log("目标元素 3 的索引 = ", index)
// 在链表中执行线性查找 // 在链表中执行线性查找
head := ArrayToLinkedListLinkedList(nums) head := ArrayToLinkedList(nums)
node := linerSearchLinkedList(head, target) node := linerSearchLinkedList(head, target)
t.Log("目标结点值 3 的对应结点对象为 ", node) t.Log("目标结点值 3 的对应结点对象为 ", node)
} }

View file

@ -24,8 +24,8 @@ func NewListNode(v int) *ListNode {
} }
} }
// ArrayToLinkedListLinkedList Generate a linked list with an array // ArrayToLinkedList Generate a linked list with an array
func ArrayToLinkedListLinkedList(arr []int) *ListNode { func ArrayToLinkedList(arr []int) *ListNode {
// dummy header of linked list // dummy header of linked list
dummy := NewListNode(0) dummy := NewListNode(0)
node := dummy node := dummy

View file

@ -8,7 +8,7 @@ import "testing"
func TestListNode(t *testing.T) { func TestListNode(t *testing.T) {
arr := []int{2, 3, 5, 6, 7} arr := []int{2, 3, 5, 6, 7}
head := ArrayToLinkedListLinkedList(arr) head := ArrayToLinkedList(arr)
PrintLinkedList(head) PrintLinkedList(head)
node := GetListNode(head, 5) node := GetListNode(head, 5)