Documentation
¶
Index ¶
- type DoublyLinkedList
- func (dll *DoublyLinkedList[T]) AddFirst(value T)
- func (dll *DoublyLinkedList[T]) AddLast(value T)
- func (dll *DoublyLinkedList[T]) Clear()
- func (dll *DoublyLinkedList[T]) GetSize() int
- func (dll *DoublyLinkedList[T]) Head() *DoublyLinkedListNode[T]
- func (dll *DoublyLinkedList[T]) IsEmpty() bool
- func (dll *DoublyLinkedList[T]) Remove(node *DoublyLinkedListNode[T]) T
- func (dll *DoublyLinkedList[T]) RemoveFirst() T
- func (dll *DoublyLinkedList[T]) RemoveLast() T
- func (dll *DoublyLinkedList[T]) Search(value T) *DoublyLinkedListNode[T]
- func (dll *DoublyLinkedList[T]) Tail() *DoublyLinkedListNode[T]
- type DoublyLinkedListNode
- func (n *DoublyLinkedListNode[T]) GetNext() *DoublyLinkedListNode[T]
- func (n *DoublyLinkedListNode[T]) GetPrev() *DoublyLinkedListNode[T]
- func (n *DoublyLinkedListNode[T]) GetValue() T
- func (n *DoublyLinkedListNode[T]) SetNext(node *DoublyLinkedListNode[T])
- func (n *DoublyLinkedListNode[T]) SetPrev(node *DoublyLinkedListNode[T])
- type Queue
- type Set
- type SinglyLinkedList
- func (l *SinglyLinkedList[T]) AddNode(node *SinglyLinkedListNode[T])
- func (l *SinglyLinkedList[T]) DeleteNode(node *SinglyLinkedListNode[T]) bool
- func (l *SinglyLinkedList[T]) Head() *SinglyLinkedListNode[T]
- func (l *SinglyLinkedList[T]) IsEmpty() bool
- func (l *SinglyLinkedList[T]) Search(value T) *SinglyLinkedListNode[T]
- type SinglyLinkedListNode
- type Stack
- type TreeNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DoublyLinkedList ¶
type DoublyLinkedList[T any] struct { // contains filtered or unexported fields }
func NewDoublyLinkedList ¶
func NewDoublyLinkedList[T any]() *DoublyLinkedList[T]
func (*DoublyLinkedList[T]) AddFirst ¶
func (dll *DoublyLinkedList[T]) AddFirst(value T)
func (*DoublyLinkedList[T]) AddLast ¶
func (dll *DoublyLinkedList[T]) AddLast(value T)
func (*DoublyLinkedList[T]) Clear ¶
func (dll *DoublyLinkedList[T]) Clear()
func (*DoublyLinkedList[T]) GetSize ¶
func (dll *DoublyLinkedList[T]) GetSize() int
func (*DoublyLinkedList[T]) Head ¶
func (dll *DoublyLinkedList[T]) Head() *DoublyLinkedListNode[T]
func (*DoublyLinkedList[T]) IsEmpty ¶
func (dll *DoublyLinkedList[T]) IsEmpty() bool
func (*DoublyLinkedList[T]) Remove ¶
func (dll *DoublyLinkedList[T]) Remove(node *DoublyLinkedListNode[T]) T
will panic if given node is nil
func (*DoublyLinkedList[T]) RemoveFirst ¶
func (dll *DoublyLinkedList[T]) RemoveFirst() T
will panic if list is empty
func (*DoublyLinkedList[T]) RemoveLast ¶
func (dll *DoublyLinkedList[T]) RemoveLast() T
will panic if list is empty
func (*DoublyLinkedList[T]) Search ¶
func (dll *DoublyLinkedList[T]) Search(value T) *DoublyLinkedListNode[T]
func (*DoublyLinkedList[T]) Tail ¶
func (dll *DoublyLinkedList[T]) Tail() *DoublyLinkedListNode[T]
type DoublyLinkedListNode ¶
type DoublyLinkedListNode[T any] struct { // contains filtered or unexported fields }
func NewDoublyLinkedListNode ¶
func NewDoublyLinkedListNode[T any](value T) *DoublyLinkedListNode[T]
func (*DoublyLinkedListNode[T]) GetNext ¶
func (n *DoublyLinkedListNode[T]) GetNext() *DoublyLinkedListNode[T]
func (*DoublyLinkedListNode[T]) GetPrev ¶
func (n *DoublyLinkedListNode[T]) GetPrev() *DoublyLinkedListNode[T]
func (*DoublyLinkedListNode[T]) GetValue ¶
func (n *DoublyLinkedListNode[T]) GetValue() T
func (*DoublyLinkedListNode[T]) SetNext ¶
func (n *DoublyLinkedListNode[T]) SetNext(node *DoublyLinkedListNode[T])
func (*DoublyLinkedListNode[T]) SetPrev ¶
func (n *DoublyLinkedListNode[T]) SetPrev(node *DoublyLinkedListNode[T])
type Queue ¶
type Queue[T any] struct { // contains filtered or unexported fields }
func NewQueueFromSlice ¶
type Set ¶
type Set[T comparable] struct { // contains filtered or unexported fields }
func NewSet ¶
func NewSet[T comparable]() Set[T]
type SinglyLinkedList ¶
type SinglyLinkedList[T any] struct { // contains filtered or unexported fields }
func NewSinglyLinkedList ¶
func NewSinglyLinkedList[T any]() *SinglyLinkedList[T]
func (*SinglyLinkedList[T]) AddNode ¶
func (l *SinglyLinkedList[T]) AddNode(node *SinglyLinkedListNode[T])
func (*SinglyLinkedList[T]) DeleteNode ¶
func (l *SinglyLinkedList[T]) DeleteNode(node *SinglyLinkedListNode[T]) bool
func (*SinglyLinkedList[T]) Head ¶
func (l *SinglyLinkedList[T]) Head() *SinglyLinkedListNode[T]
func (*SinglyLinkedList[T]) IsEmpty ¶
func (l *SinglyLinkedList[T]) IsEmpty() bool
func (*SinglyLinkedList[T]) Search ¶
func (l *SinglyLinkedList[T]) Search(value T) *SinglyLinkedListNode[T]
type SinglyLinkedListNode ¶
type SinglyLinkedListNode[T any] struct { // contains filtered or unexported fields }
func NewSinglyLinkedListNode ¶
func NewSinglyLinkedListNode[T any](value T) *SinglyLinkedListNode[T]
func (*SinglyLinkedListNode[T]) GetNext ¶
func (n *SinglyLinkedListNode[T]) GetNext() *SinglyLinkedListNode[T]
func (*SinglyLinkedListNode[T]) GetValue ¶
func (n *SinglyLinkedListNode[T]) GetValue() T
func (*SinglyLinkedListNode[T]) SetNext ¶
func (n *SinglyLinkedListNode[T]) SetNext(node *SinglyLinkedListNode[T])
type Stack ¶
type Stack[T any] struct { // contains filtered or unexported fields }
func NewFromSlice ¶
func (Stack[T]) Peek ¶
func (s Stack[T]) Peek() T
please make sure the stack is not empty or the method will raise a panic.
type TreeNode ¶
TreeNode represents a node in a generic tree.
func NewTreeNode ¶
NewTreeNode creates a new TreeNode with the given value.
func (*TreeNode[T]) DepthFirstTraversal ¶
func (n *TreeNode[T]) DepthFirstTraversal() []T
DepthFirstTraversal performs a depth-first traversal of the tree rooted at the current node and returns a slice of values.
Click to show internal directories.
Click to hide internal directories.