Documentation ¶
Overview ¶
Package datastructure implements some data structure. eg. list, linklist, stack, queue, tree, graph.
Index ¶
- type List
- func (l *List[T]) Clear()
- func (l *List[T]) Clone() *List[T]
- func (l *List[T]) Contain(value T) bool
- func (l *List[T]) Data() []T
- func (l *List[T]) DeleteAt(index int)
- func (l *List[T]) Equal(other *List[T]) bool
- func (l *List[T]) IndexOf(value T) int
- func (l *List[T]) InsertAt(index int, value T)
- func (l *List[T]) InsertAtFirst(value T)
- func (l *List[T]) InsertAtLast(value T)
- func (l *List[T]) Intersection(other *List[T]) *List[T]
- func (l *List[T]) IsEmpty() bool
- func (l *List[T]) Merge(other *List[T]) *List[T]
- func (l *List[T]) PopFirst() (*T, bool)
- func (l *List[T]) PopLast() (*T, bool)
- func (l *List[T]) Push(value T)
- func (l *List[T]) Reverse()
- func (l *List[T]) Size() int
- func (l *List[T]) Swap(i, j int)
- func (l *List[T]) Union(other *List[T]) *List[T]
- func (l *List[T]) Unique()
- func (l *List[T]) UpdateAt(index int, value T)
- func (l *List[T]) ValueOf(index int) (*T, bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type List ¶
type List[T any] struct { // contains filtered or unexported fields }
List is a linear table, implemented with slice
func (*List[T]) InsertAtFirst ¶
func (l *List[T]) InsertAtFirst(value T)
InsertAtFirst insert value into list at first index
func (*List[T]) InsertAtLast ¶
func (l *List[T]) InsertAtLast(value T)
InsertAtLast insert value into list at last index
func (*List[T]) Intersection ¶
Intersection creates a new list whose element both be contained in list l and other
func (*List[T]) Union ¶
Union creates a new list contain all element in list l and other, remove duplicate element.
Click to show internal directories.
Click to hide internal directories.