Last active
June 15, 2020 01:01
-
-
Save pacuna/11a39e9562b5f3829e11ca7a8540d5f2 to your computer and use it in GitHub Desktop.
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 characters
type node struct { | |
item []byte | |
key uint64 | |
next *node | |
} | |
func newNode(item []byte) *node { | |
key, _ := hashstructure.Hash(item, nil) | |
return &node{ | |
item: item, | |
key: key, | |
} | |
} | |
type list struct { | |
head *node | |
size int | |
} | |
func New() *list { | |
head := &node{ | |
key: 0, | |
} | |
tail := &node{ | |
key: math.MaxUint64, | |
} | |
head.next = tail | |
return &list{ | |
head: head, | |
size: 0, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment