singlylinkedlist

package
v0.0.0-...-786b671 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkedList

type LinkedList[T constraints.Ordered] struct {
	// contains filtered or unexported fields
}

LinkedList represents a singly linked list with nodes with values of type T.

func New

func New[T constraints.Ordered]() *LinkedList[T]

New creates a new, empty singly linked list with nodes with values of type T.

func (*LinkedList[T]) Append

func (ll *LinkedList[T]) Append(value T)

Append adds a new element at the end of the list.

func (*LinkedList[T]) Contains

func (ll *LinkedList[T]) Contains(value T) bool

Contains returns true if the list contains the given value, false otherwise.

func (*LinkedList[T]) Delete

func (ll *LinkedList[T]) Delete(value T)

Delete deletes an element from the list.

func (*LinkedList[T]) Length

func (ll *LinkedList[T]) Length() int

Length returns the length of the list.

func (*LinkedList[T]) Prepend

func (ll *LinkedList[T]) Prepend(value T)

Prepend adds a new element at the beginning of the list.

func (*LinkedList[T]) Print

func (ll *LinkedList[T]) Print()

Print prints the list.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL