This is a creation in Article, where the information may have evolved or changed.
In computer science, a linked list was a linear collection of data elements, in which linear order isn't given by their ph ysical placement in memory. Each pointing to the next node by means of a pointer. It is a data structure consisting of a group of nodes which together represent a sequence. Here's source code of the Go program to Implement single unsorted Linked List
Linked List in golangpackage main import "FMT" type Node struct {prev *node next *node key interface{}} type List struct {head *node tail *node} func (L *list) Insert (Key interface{}) {list: = &node{next:l. Head, Key:key,} if l.head! = Nil {l.head.prev = list} L.head = list L: = L.head for L.next! = Nil {L = l.next} l.tail = L} func (L *list) Display () {List: = L.head for List! = Nil { Fmt. Printf ("%+v", list.key) List = List.next} fmt. Println ()} func Display (list *node) {for list! = nil {fmt. Printf ("%v", list.key) List = List.next} fmt. Println ()} func showbackwards (list *node) {for list! = nil {fmt. Printf ("%v <-", list.key) List = List.prev} fmt. Println ()} func (L *list) Reverse () {curr: = l.head var prev *node l.tail = L.head for Curr! = Nil { Next: = Curr.next Curr.next = prEV prev = Curr Curr = next} l.head = prev Display (l.head)} func main () {link: = list{} link . Insert (5) Link. Insert (9) Link. Insert (+) link. Insert (+) link. Insert () Link. Insert (*) fmt. Println ("\n==============================\n") fmt. Printf ("Head:%v\n", Link.head.key) fmt. Printf ("Tail:%v\n", Link.tail.key) link. Display () fmt. Println ("\n==============================\n") fmt. Printf ("Head:%v\n", Link.head.key) fmt. Printf ("Tail:%v\n", Link.tail.key) link. Reverse () fmt. Println ("\n==============================\n")}
C:\golang\time>go run link.go==============================Head: 36Tail: 536 ->28 ->22 ->13 ->9 ->5 ->==============================head: 36tail: 55 ->9 ->13 ->22 ->28 ->36 ->==============================C:\golang\time>