Last active
August 29, 2015 14:16
-
-
Save enahs/1d6ec40d9251a32b32d9 to your computer and use it in GitHub Desktop.
Revisions
-
enahs renamed this gist
Mar 7, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
enahs renamed this gist
Mar 7, 2015 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
enahs revised this gist
Mar 7, 2015 . No changes.There are no files selected for viewing
-
enahs created this gist
Mar 7, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ package main import "fmt" type Node struct { Data interface{} Next *Node } type list struct { Len int Head, Tail *Node } func (L *list) Push(n *Node) { if L.Len == 0 { L.Head = n } else { L.Tail.Next = n } L.Tail = n L.Len++ } func main() { L := &list{} n1, n2, n3 := &Node{1, nil}, &Node{2, nil}, &Node{3, nil} L.Push(n1) L.Push(n2) L.Push(n3) for curr := L.Head; curr != nil; curr = curr.Next { fmt.Printf("%#v", curr.Data) } }