Documentation ¶
Index ¶
- type DoublyLink
- func (link *DoublyLink[T]) Clear()
- func (link *DoublyLink[T]) DeleteAt(index int) error
- func (link *DoublyLink[T]) DeleteAtHead() error
- func (link *DoublyLink[T]) DeleteAtTail() error
- func (link *DoublyLink[T]) GetMiddleNode() *datastructure.LinkNode[T]
- func (link *DoublyLink[T]) InsertAt(index int, value T) error
- func (link *DoublyLink[T]) InsertAtHead(value T)
- func (link *DoublyLink[T]) InsertAtTail(value T)
- func (link *DoublyLink[T]) IsEmpty() bool
- func (link *DoublyLink[T]) Print()
- func (link *DoublyLink[T]) Reverse()
- func (link *DoublyLink[T]) Size() int
- func (link *DoublyLink[T]) Values() []T
- type SinglyLink
- func (link *SinglyLink[T]) Clear()
- func (link *SinglyLink[T]) DeleteAt(index int) error
- func (link *SinglyLink[T]) DeleteAtHead() error
- func (link *SinglyLink[T]) DeleteAtTail() error
- func (link *SinglyLink[T]) DeleteValue(value T)
- func (link *SinglyLink[T]) GetMiddleNode() *datastructure.LinkNode[T]
- func (link *SinglyLink[T]) InsertAt(index int, value T) error
- func (link *SinglyLink[T]) InsertAtHead(value T)
- func (link *SinglyLink[T]) InsertAtTail(value T)
- func (link *SinglyLink[T]) IsEmpty() bool
- func (link *SinglyLink[T]) Print()
- func (link *SinglyLink[T]) Reverse()
- func (link *SinglyLink[T]) Size() int
- func (link *SinglyLink[T]) Values() []T
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoublyLink ¶
type DoublyLink[T any] struct { Head *datastructure.LinkNode[T] // contains filtered or unexported fields }
DoublyLink is a linked list. Whose node has a generic Value, Pre pointer points to a previous node of the link, Next pointer points to a next node of the link.
func NewDoublyLink ¶
func NewDoublyLink[T any]() *DoublyLink[T]
NewDoublyLink return *DoublyLink instance
func (*DoublyLink[T]) Clear ¶
func (link *DoublyLink[T]) Clear()
Clear checks if link is empty or not
func (*DoublyLink[T]) DeleteAt ¶
func (link *DoublyLink[T]) DeleteAt(index int) error
DeleteAt delete value in doubly linklist at index
func (*DoublyLink[T]) DeleteAtHead ¶
func (link *DoublyLink[T]) DeleteAtHead() error
DeleteAtHead delete value in doubly linklist at head index
func (*DoublyLink[T]) DeleteAtTail ¶
func (link *DoublyLink[T]) DeleteAtTail() error
DeleteAtTail delete value in doubly linklist at tail index
func (*DoublyLink[T]) GetMiddleNode ¶
func (link *DoublyLink[T]) GetMiddleNode() *datastructure.LinkNode[T]
GetMiddleNode return node at middle index of linked list
func (*DoublyLink[T]) InsertAt ¶
func (link *DoublyLink[T]) InsertAt(index int, value T) error
InsertAt insert value into doubly linklist at index
func (*DoublyLink[T]) InsertAtHead ¶
func (link *DoublyLink[T]) InsertAtHead(value T)
InsertAtHead insert value into doubly linklist at head index
func (*DoublyLink[T]) InsertAtTail ¶
func (link *DoublyLink[T]) InsertAtTail(value T)
InsertAtTail insert value into doubly linklist at tail index
func (*DoublyLink[T]) IsEmpty ¶
func (link *DoublyLink[T]) IsEmpty() bool
IsEmpty checks if link is empty or not
func (*DoublyLink[T]) Print ¶
func (link *DoublyLink[T]) Print()
Print all nodes info of a linked list
func (*DoublyLink[T]) Size ¶
func (link *DoublyLink[T]) Size() int
Size return the count of doubly linked list
func (*DoublyLink[T]) Values ¶
func (link *DoublyLink[T]) Values() []T
Values return slice of all doubly linklist node value
type SinglyLink ¶
type SinglyLink[T any] struct { Head *datastructure.LinkNode[T] // contains filtered or unexported fields }
SinglyLink is a linked list. Whose node has a Value generics and Next pointer points to a next node of the link.
func NewSinglyLink ¶
func NewSinglyLink[T any]() *SinglyLink[T]
NewSinglyLink return *SinglyLink instance
func (*SinglyLink[T]) Clear ¶
func (link *SinglyLink[T]) Clear()
Clear checks if link is empty or not
func (*SinglyLink[T]) DeleteAt ¶
func (link *SinglyLink[T]) DeleteAt(index int) error
DeleteAt delete value in singly linklist at index
func (*SinglyLink[T]) DeleteAtHead ¶
func (link *SinglyLink[T]) DeleteAtHead() error
DeleteAtHead delete value in singly linklist at head index
func (*SinglyLink[T]) DeleteAtTail ¶
func (link *SinglyLink[T]) DeleteAtTail() error
DeleteAtTail delete value in singly linklist at tail index
func (*SinglyLink[T]) DeleteValue ¶ added in v2.0.2
func (link *SinglyLink[T]) DeleteValue(value T)
DeleteValue delete value in singly linklist
func (*SinglyLink[T]) GetMiddleNode ¶
func (link *SinglyLink[T]) GetMiddleNode() *datastructure.LinkNode[T]
GetMiddleNode return node at middle index of linked list
func (*SinglyLink[T]) InsertAt ¶
func (link *SinglyLink[T]) InsertAt(index int, value T) error
InsertAt insert value into singly linklist at index
func (*SinglyLink[T]) InsertAtHead ¶
func (link *SinglyLink[T]) InsertAtHead(value T)
InsertAtHead insert value into singly linklist at head index
func (*SinglyLink[T]) InsertAtTail ¶
func (link *SinglyLink[T]) InsertAtTail(value T)
InsertAtTail insert value into singly linklist at tail index
func (*SinglyLink[T]) IsEmpty ¶
func (link *SinglyLink[T]) IsEmpty() bool
IsEmpty checks if link is empty or not
func (*SinglyLink[T]) Print ¶
func (link *SinglyLink[T]) Print()
Print all nodes info of a linked list
func (*SinglyLink[T]) Size ¶
func (link *SinglyLink[T]) Size() int
Size return the count of singly linked list
func (*SinglyLink[T]) Values ¶
func (link *SinglyLink[T]) Values() []T
Values return slice of all singly linklist node value