GO实现一个单链表不多BB,直接上代码,有关链表定义,请自行百度
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051package mainimport "fmt"type ListNode struct { Val interface{} Next *ListNode}// 初始化func New() *ListNode { return &ListNode{nil, nil}}// 遍历输出func (head *ListNode) Traverse() { point := head fmt.Println("--------start----------") for nil != point { fmt.Println(point.Val) point = point.Next } fmt.Print ...