list

package
v0.0.0-...-19a3f40 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

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

func NewIntList

func NewIntList(headValue int) *List

func (*List) AddNode

func (l *List) AddNode(n *Node)

func (*List) ChangeToRing

func (l *List) ChangeToRing()

变身成环

func (*List) InsertAfter

func (l *List) InsertAfter(after, current *Node) error

func (*List) InsertBefore

func (l *List) InsertBefore(current, n *Node) error

func (*List) Remove

func (l *List) Remove(current *Node) error

func (*List) Traverse

func (l *List) Traverse(fn func(n *Node))

type Node

type Node struct {
	// 存储你需要存储的数据
	Value interface{}
	// 下一跳的指向
	Next *Node
	// 上一跳
	Prev *Node
}

定义节点

func NewIntNode

func NewIntNode(v int) *Node

Jump to

Keyboard shortcuts

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