Documentation ¶
Index ¶
- type Element
- type LinkedList
- func (l *LinkedList[T]) Clear()
- func (l *LinkedList[T]) Delete(ln *Element[T])
- func (l *LinkedList[T]) DeleteAtHead()
- func (l *LinkedList[T]) DeleteAtTail()
- func (l *LinkedList[T]) InsertAfter(data T, at *Element[T]) *Element[T]
- func (l *LinkedList[T]) InsertAtHead(data T) *Element[T]
- func (l *LinkedList[T]) InsertAtTail(data T) *Element[T]
- func (l *LinkedList[T]) InsertBefore(data T, at *Element[T]) *Element[T]
- func (l *LinkedList[T]) Length() int
- func (l *LinkedList[T]) Values() []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Element ¶
func NewElement ¶
type LinkedList ¶
type LinkedList[T any] struct { Head *Element[T] Tail *Element[T] // contains filtered or unexported fields }
LinkedList represents a doubly linked list.
func New ¶
func New[T any]() *LinkedList[T]
func (*LinkedList[T]) Clear ¶
func (l *LinkedList[T]) Clear()
Clear removes all nodes from the list, making it empty.
func (*LinkedList[T]) Delete ¶
func (l *LinkedList[T]) Delete(ln *Element[T])
Delete removes a specific node from the list.
func (*LinkedList[T]) DeleteAtHead ¶
func (l *LinkedList[T]) DeleteAtHead()
DeleteAtHead deletes the node at the head of the list.
func (*LinkedList[T]) DeleteAtTail ¶
func (l *LinkedList[T]) DeleteAtTail()
DeleteAtTail deletes the node at the tail of the list.
func (*LinkedList[T]) InsertAfter ¶
func (l *LinkedList[T]) InsertAfter(data T, at *Element[T]) *Element[T]
func (*LinkedList[T]) InsertAtHead ¶
func (l *LinkedList[T]) InsertAtHead(data T) *Element[T]
InsertAtHead inserts a new node at the head of the list.
func (*LinkedList[T]) InsertAtTail ¶
func (l *LinkedList[T]) InsertAtTail(data T) *Element[T]
InsertAtTail appends a new node at the tail of the list.
func (*LinkedList[T]) InsertBefore ¶
func (l *LinkedList[T]) InsertBefore(data T, at *Element[T]) *Element[T]
func (*LinkedList[T]) Length ¶
func (l *LinkedList[T]) Length() int
Length returns the number of nodes in the list.
func (*LinkedList[T]) Values ¶
func (l *LinkedList[T]) Values() []T
Values returns a slice of values in the list.
Click to show internal directories.
Click to hide internal directories.