linear_data_structure

package
v0.0.0-...-517d9f4 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package linear_data_structure Time : 2021/5/10 8:21 下午 Author : xushiyin contact : yuqingxushiyin@gmail.com please check go standard package container/list, this is very important!!!

Package linear_data_structure Time : 2021/5/9 10:23 下午 Author : xushiyin contact : yuqingxushiyin@gmail.com LinkedList is a sequence of nodes that have properties and a reference to the next node in the sequence. It is a linear data structure that is used to store data. The data structure permits the addition and deletion of components from any node next to another node. They are not stored contiguously in memory, which makes them different arrays.

Package linear_data_structure Time : 2021/5/11 9:42 上午 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package linear_data_structure Time : 2021/5/11 9:22 上午 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package linear_data_structure Time : 2021/5/11 7:47 下午 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package linear_data_structure Time : 2021/5/11 9:38 上午 Author : xushiyin contact : yuqingxushiyin@gmail.com

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PowerSeries

func PowerSeries(a int) (int, int)

PowerSeries gets the power series of integer a and returns tuple of square and cube

Types

type DNode

type DNode struct {
	Property     int
	NextNode     *DNode
	PreviousNode *DNode
}

DNode double linked list node

type DoubleLinkedList

type DoubleLinkedList struct {
	HeadNode *DNode
}

DoubleLinkedList class

func (*DoubleLinkedList) AddAfter

func (dLinkedList *DoubleLinkedList) AddAfter(nodeProperty, property int)

AddAfter method of DoubleLinkedList

func (*DoubleLinkedList) AddToHead

func (dLinkedList *DoubleLinkedList) AddToHead(property int)

AddToHead method of DoubleLinkedList

func (*DoubleLinkedList) NodeBetweenValues

func (dLinkedList *DoubleLinkedList) NodeBetweenValues(firstProperty, secondProperty int) *DNode

NodeBetweenValues method of DoubleLinkedList

func (*DoubleLinkedList) NodeWithValue

func (dLinkedList *DoubleLinkedList) NodeWithValue(p int) *DNode

NodeWithValue method returns DNode given parameter Property

type Element

type Element struct {
	ElementValue int
}

Element class

func (*Element) String

func (element *Element) String() string

String method on Element class

type LinkedList

type LinkedList struct {
	HeadNode *Node
}

LinkedList class

func (*LinkedList) AddAfter

func (linkedList *LinkedList) AddAfter(nodeProperty int, property int)

AddAfter method adds a node with nodeProperty after node with Property

func (*LinkedList) AddBefore

func (linkedList *LinkedList) AddBefore(nodeProperty int, property int)

AddBefore method adds a node with nodeProperty before node with Property

func (*LinkedList) AddToEnd

func (linkedList *LinkedList) AddToEnd(p int)

AddToEnd method adds the node with Property to the end

func (*LinkedList) AddToHead

func (linkedList *LinkedList) AddToHead(p int)

AddToHead method of LinkedList class

func (*LinkedList) DelEnd

func (linkedList *LinkedList) DelEnd()

DelEnd method delete the last node

func (*LinkedList) DelHead

func (linkedList *LinkedList) DelHead()

DelHead method of LinkedList class

func (*LinkedList) DelNodeWithValue

func (linkedList *LinkedList) DelNodeWithValue(p int)

DelNodeWithValue method delete node with value

func (*LinkedList) DelNodeWithValue1

func (linkedList *LinkedList) DelNodeWithValue1(p int)

DelNodeWithValue1 method delete node with value 教科书

func (*LinkedList) DelNodeWithValueX

func (linkedList *LinkedList) DelNodeWithValueX(p int)

DelNodeWithValueX method delete node Linux

func (*LinkedList) IterateList

func (linkedList *LinkedList) IterateList()

IterateList method iterates over LinkedList

func (*LinkedList) LastNode

func (linkedList *LinkedList) LastNode() *Node

LastNode method returns the last Node

func (*LinkedList) LinkedListLen

func (linkedList *LinkedList) LinkedListLen() int

LinkedListLen method delete node with vale

func (*LinkedList) NodeWithValue

func (linkedList *LinkedList) NodeWithValue(p int) *Node

NodeWithValue method returns Node given parameter Property

type Node

type Node struct {
	Property int
	NextNode *Node
}

Node class

type Order

type Order struct {
	Priority     int
	Quantity     int
	Product      string
	CustomerName string
}

Order class

func (*Order) New

func (order *Order) New(priority int, quantity int, product string,
	customerName string)

New method initializes with Order with priority, quantity, product, customerName

type Queue

type Queue []*Order

func (*Queue) Add

func (queue *Queue) Add(order *Order)

Add method adds the order to the queue

type Set

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

Set class

func (*Set) AddElement

func (set *Set) AddElement(element int)

AddElement adds the element to the set

func (*Set) ContainsElement

func (set *Set) ContainsElement(element int) bool

ContainsElement judge the element whether in set

func (*Set) DeleteElement

func (set *Set) DeleteElement(element int)

DeleteElement deletes the element from the set

func (*Set) Intersect

func (set *Set) Intersect(anotherSet *Set) *Set

Intersect method returns the set which intersects with anotherSet

func (*Set) New

func (set *Set) New()

New to create the map of integer and bool

func (*Set) Union

func (set *Set) Union(anotherSet *Set) *Set

Union method returns the set which is union of the set with anotherSet

type Stack

type Stack struct {
	Elements   []*Element
	ElementCnt int
}

func (*Stack) New

func (stack *Stack) New()

New return a new stack

func (*Stack) Pop

func (stack *Stack) Pop() *Element

Pop removes and returns a node from the stack in last to first order

func (*Stack) Push

func (stack *Stack) Push(e *Element)

Push adds a node to the stack

Jump to

Keyboard shortcuts

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