链表 链表(Linked list),是一种线性表,但是并不会按线性的顺序存储数据,而是在每一个节点里存到下一个节点的指针(Pointer). 每个节点包含下一个节点的地址,这样把所有的节点串起来了,通常把 链表中的第一个节点叫做链表头 单链表 package main import ( "fmt" ) type test struct { name string age uint8 intro string next *test } func printList(str *test)
原文地址:http://www.niu12.com/article/47package main import "fmt" type ListNode struct { Value int Next *ListNode} func main() { one := makeListNode([]int{1, 2, 3}) for one != nil { fmt.Println(one.Value) one = one.Next }} func makeListNode(nums []i
package main import "fmt" type Object interface{} type Node struct { data Object next *Node } type List struct { headNode *Node } func NewNode(data Object, next *Node) *Node { return &Node{data, next} } func (list *List) IsEmpty() bool { ret