func (ll *Sll) PushHeadNode(n *Node) {
	n.list = ll
	atomic.AddUint64(&ll.len, 1)
	insertAt(n, ll.root.prev)
}
PushHeadNode pushes an existing node
to the head of the *Sll.
package sll
import (
	"container/heap"
	"sort"
	"sync/atomic"
)
type Sll struct {
	root *Node
	len  uint64
}
type Node struct {
	next  *Node
	prev  *Node
	list  *Sll
	Score uint64
	Value interface{}
}
func (n *Node) Next() *Node {
	if n.next != n.list.root {
		return n.next
	}
	return nil
}
func (n *Node) Prev() *Node {
	if n.prev != n.list.root {
		return n.prev
	}
	return nil
}
func (n *Node) Copy() *Node {
	return &Node{
		Score: n.Score,
		Value: n.Value,
	}
}
func New() *Sll {
	ll := &Sll{
		root: &Node{},
	}
	ll.root.next, ll.root.prev = ll.root, ll.root
	return ll
}
type NodeScoreList []*Node
func (n *Node) Read() interface{} {
	atomic.AddUint64(&n.Score, 1)
	return n.Value
}
func (nsl NodeScoreList) Len() int {
	return len(nsl)
}
func (nsl NodeScoreList) Less(i, j int) bool {
	return atomic.LoadUint64(&nsl[i].Score) < atomic.LoadUint64(&nsl[j].Score)
}
func (nsl NodeScoreList) Swap(i, j int) {
	nsl[i], nsl[j] = nsl[j], nsl[i]
}
func (ll *Sll) Len() uint {
	return uint(ll.len)
}
func (ll *Sll) Head() *Node {
	return ll.root.prev
}
func (ll *Sll) Tail() *Node {
	return ll.root.next
}
func (ll *Sll) Copy() *Sll {
	newll := New()
	for node := ll.Head(); node != nil; node = node.Prev() {
		c := node.Copy()
		newll.PushTailNode(c)
	}
	return newll
}
func (ll *Sll) HighScores(k int) NodeScoreList {
	h := &MinHeap{}
	if ll.Len() == 0 {
		return NodeScoreList(*h)
	}
	heap.Init(h)
	node := ll.Head()
	for i := 0; i < k && node != nil; i++ {
		heap.Push(h, node)
		node = node.Prev()
	}
	var min = h.Peek().(*Node).Score
	for ; node != nil; node = node.Prev() {
		if node.Score > min {
			heap.Push(h, node)
			heap.Pop(h)
			min = h.Peek().(*Node).Score
		}
	}
	scores := NodeScoreList(*h)
	sort.Sort(scores)
	return scores
}
func (ll *Sll) LowScores(k int) NodeScoreList {
	h := &MaxHeap{}
	if ll.Len() == 0 {
		return NodeScoreList(*h)
	}
	node := ll.Tail()
	for i := 0; i < k && node != nil; i++ {
		heap.Push(h, node)
		node = node.Next()
	}
	var max = h.Peek().(*Node).Score
	for ; node != nil; node = node.Next() {
		if node.Score < max {
			heap.Push(h, node)
			heap.Pop(h)
			max = h.Peek().(*Node).Score
		}
	}
	scores := NodeScoreList(*h)
	sort.Sort(scores)
	return scores
}
func insertAt(n, at *Node) {
	n.next = at.next
	at.next = n
	n.prev = at
	n.next.prev = n
}
func pull(n *Node) {
	n.next.prev, n.prev.next = n.prev, n.next
	n.next, n.prev = nil, nil
}
func (ll *Sll) MoveToHead(n *Node) {
	if ll.root.prev == n {
		return
	}
	pull(n)
	insertAt(n, ll.root.prev)
}
func (ll *Sll) MoveToTail(n *Node) {
	if ll.root.next == n {
		return
	}
	pull(n)
	insertAt(n, ll.root)
}
func (ll *Sll) PushHead(v interface{}) *Node {
	n := &Node{
		Value: v,
		Score: 0,
		list:  ll,
	}
	atomic.AddUint64(&ll.len, 1)
	insertAt(n, ll.root.prev)
	return n
}
func (ll *Sll) PushTail(v interface{}) *Node {
	n := &Node{
		Value: v,
		Score: 0,
		list:  ll,
	}
	atomic.AddUint64(&ll.len, 1)
	insertAt(n, ll.root)
	return n
}