list

package
Version: v0.0.0-...-5b112dc Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DLList

type DLList struct {
	// contains filtered or unexported fields
}

DLList represents a doubly linked list

func NewDLList

func NewDLList() *DLList

New returns an initialized list

func (*DLList) Back

func (l *DLList) Back() *DLNode

Back returns the last element of list, or nil if it's empty

func (*DLList) Front

func (l *DLList) Front() *DLNode

Front returns the first element of list, or nil if it's empty

func (*DLList) Init

func (l *DLList) Init() *DLList

Init initializes or clears

func (*DLList) InsertAfter

func (l *DLList) InsertAfter(v ValType, mark *DLNode) *DLNode

InsertAfter inserts a new element e with value v immediately after mark (must not be nil!) and returns e

func (*DLList) InsertBefore

func (l *DLList) InsertBefore(v ValType, mark *DLNode) *DLNode

InsertBefore inserts a new element e with value v immediately before mark (must not be nil!) and returns e

func (*DLList) Len

func (l *DLList) Len() int

Len returns the number of elements

func (*DLList) MoveAfter

func (l *DLList) MoveAfter(e, mark *DLNode)

MoveAfter moves element e to its new position after mark (e or mark must not be nil!)

func (*DLList) MoveBefore

func (l *DLList) MoveBefore(e, mark *DLNode)

MoveBefore moves element e to its new position before mark (e or mark must not be nil!)

func (*DLList) MoveToBack

func (l *DLList) MoveToBack(e *DLNode)

MoveToBack moves element e (must not be nil!) to the back of list l.

func (*DLList) MoveToFront

func (l *DLList) MoveToFront(e *DLNode)

MoveToFront moves element e (must not be nil!) to the front of list l

func (*DLList) PushBack

func (l *DLList) PushBack(v ValType) *DLNode

PushBack inserts a new element e with value v at the back of list l and returns e

func (*DLList) PushBackList

func (l *DLList) PushBackList(other *DLList)

PushBackList inserts a copy of another list at the back of list l The lists l and other may be the same (must not be nil!)

func (*DLList) PushFront

func (l *DLList) PushFront(v ValType) *DLNode

PushFront inserts a new element e with value v at the front of list l and returns e

func (*DLList) PushFrontList

func (l *DLList) PushFrontList(other *DLList)

PushFrontList inserts a copy of another list at the front of list l The lists l and other may be the same (must not be nil!)

func (*DLList) Remove

func (l *DLList) Remove(e *DLNode) interface{}

Remove removes e from l if e is an element of list l It returns the element value e.Value (must not be nil)

type DLNode

type DLNode struct {
	Value ValType
	// contains filtered or unexported fields
}

DLNode is an element of a linked list

func (*DLNode) Next

func (e *DLNode) Next() *DLNode

Next returns the next list element, or nil

func (*DLNode) Prev

func (e *DLNode) Prev() *DLNode

Prev returns the previous list element, or nil

type ValType

type ValType = interface{}

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL