datastructure

package
v0.0.0-...-4eba188 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Overview

Package datastructure implements some data structure. eg. list, linklist, stack, queue, tree, graph.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LinkNode

type LinkNode[T any] struct {
	Value T
	Pre   *LinkNode[T]
	Next  *LinkNode[T]
}

LinkNode is a linkedlist node, which have a Value and Pre points to previous node, Next points to a next node of the link.

func NewLinkNode

func NewLinkNode[T any](value T) *LinkNode[T]

NewLinkNode return a LinkNode pointer

type QueueNode

type QueueNode[T any] struct {
	Value T
	Next  *QueueNode[T]
}

QueueNode is a node in a queue, which have a Value and Next pointer points to next node in the queue.

func NewQueueNode

func NewQueueNode[T any](value T) *QueueNode[T]

NewQueueNode return a QueueNode pointer

type StackNode

type StackNode[T any] struct {
	Value T
	Next  *StackNode[T]
}

StackNode is a node in stack, which have a Value and Next pointer points to next node in the stack.

func NewStackNode

func NewStackNode[T any](value T) *StackNode[T]

NewStackNode return a StackNode pointer

type TreeNode

type TreeNode[T any] struct {
	Value T
	Left  *TreeNode[T]
	Right *TreeNode[T]
}

TreeNode is node of tree

func NewTreeNode

func NewTreeNode[T any](val T) *TreeNode[T]

NewTreeNode return a TreeNode pointer

Directories

Path Synopsis
Package datastructure implements some data structure.
Package datastructure implements some data structure.
Package datastructure implements some data structure.
Package datastructure implements some data structure.
Package datastructure implements some data structure.
Package datastructure implements some data structure.

Jump to

Keyboard shortcuts

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