Skip to content

Instantly share code, notes, and snippets.

@pacuna
Last active June 15, 2020 01:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pacuna/11a39e9562b5f3829e11ca7a8540d5f2 to your computer and use it in GitHub Desktop.
Save pacuna/11a39e9562b5f3829e11ca7a8540d5f2 to your computer and use it in GitHub Desktop.
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