MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / Singly

Struct Singly

structure/linkedlist/singlylinkedlist.go:10–16  ·  view source on GitHub ↗

Singly structure with length of the list and its head

Source from the content-addressed store, hash-verified

8
9// Singly structure with length of the list and its head
10type Singly[T any] struct {
11 length int
12
13 // Note that Node here holds both Next and Prev Node
14 // however only the Next node is used in Singly methods.
15 Head *Node[T]
16}
17
18// NewSingly returns a new instance of a linked list
19func NewSingly[T any]() *Singly[T] {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected