Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Double ¶
type Double[T any] struct { // contains filtered or unexported fields }
Double is a doubly-linked list. Unlike Single, nodes of a Double can be removed from the middle of the list rather than only the ends.
func (Double[T]) Nodes ¶
func (ls Double[T]) Nodes() iter.Seq[*DoubleNode[T]]
Nodes returns an iterator over the nodes of the list. It is safe to remove the currently-yielded node from the list during iteration.
func (*Double[T]) Push ¶
func (ls *Double[T]) Push(v T)
Push adds a new node containing v to the tail of the list.
func (*Double[T]) Remove ¶
func (ls *Double[T]) Remove(n *DoubleNode[T])
Remove removes the given node from the list.
type DoubleNode ¶
type DoubleNode[T any] struct { Val T // contains filtered or unexported fields }
DoubleNode is a node of a Double.
type Single ¶
type Single[T any] struct { // contains filtered or unexported fields }
Single is a singly-linked list that also contains a reference to the last node for quick inserts and removals at the head and tail.
func (*Single[T]) Enqueue ¶
func (ls *Single[T]) Enqueue(v T)
Enqueue adds v as a new node at the tail of the list.
type SingleNode ¶
type SingleNode[T any] struct { Val T // contains filtered or unexported fields }
SingleNode is a node of a Single.
Click to show internal directories.
Click to hide internal directories.