From f53776ede0899e4293d233749f66ea6c1c3559df Mon Sep 17 00:00:00 2001 From: Acid Date: Sat, 2 May 2026 14:52:24 -0400 Subject: [PATCH] added NewLinkedList --- linear/linkedList.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/linear/linkedList.go b/linear/linkedList.go index 31b6616..d5101e9 100644 --- a/linear/linkedList.go +++ b/linear/linkedList.go @@ -16,6 +16,11 @@ type LinkedList[T any] struct { length uint8 } +// NewLinkedList() -> Creates a linked list NewLinkedList[Type]() +func NewLinkedList[T any]() *LinkedList[T] { + return &LinkedList[T]{} +} + // InsertAtHead() -> inserts data and sets it as head func (ll *LinkedList[T]) InsertAtHead(data T) { newNode := &Node[T]{data: data}