OneWayLinkedListGo

command module
v0.0.0-...-17b4ecc Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

README

One-Way Linked-List Go

This is a simple implementation of a one-way linked-list in Go. The one way linkedlist is a data structure that is made up of nodes. Each node contains a value and a pointer to the next node. The head of the list is the first node in the list. The tail of the list is the last node in the list. The tail of the list points to nil.

Structure

Types:

type Node struct {
	Value interface{}
	Next  *Node
}

type List struct {
	Head *Node
}

Methods:

// Create, O(1)
func (list *List) Create(value interface{})

// InsertBegin, O(1)
func (list *List) InsertBegin(value interface{})

// InsertEnd, O(n)
func (list *List) InsertEnd(value interface{})

// InsertAfter, O(n)
func (list *List) InsertAfter(value interface{}, after interface{})

// InsertBefore, O(n)
func (list *List) InsertBefore(value interface{}, before interface{})

// DeleteBegin, O(1)
func (list *List) DeleteBegin()

// DeleteEnd, O(n)
func (list *List) DeleteEnd()

// DeleteValue, O(n)
func (list *List) DeleteValue(value interface{})

// DeleteAfterValue, O(n)
func (list *List) DeleteAfterValue(value interface{})

// DeleteBeforeValue, O(n)
func (list *List) DeleteBeforeValue(value interface{})

// DeleteIndex, O(n)
func (list *List) DeleteIndex(index int)

// DeleteAfterIndex, O(n)
func (list *List) DeleteAfterIndex(index int)

// DeleteBeforeIndex, O(n)
func (list *List) DeleteBeforeIndex(index int)

// Search, O(n)
func (list *List) Search(value interface{}) bool

// Print, O(n)
func (list *List) Print()

// ToString, O(n)
func (list *List) ToString() string

© Copyright 2022, Max Base

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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