non_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 non_linear_data_structure Time : 2021/5/16 2:15 下午 Author : xushiyin contact : yuqingxushiyin@gmail.com Adelson, Velski, and Landis pioneered the AVL tree data structure and hence it is named after them. It consists of height adjusting binary search trees. The balance factor is obtained by finding the difference between the heights of the left and right sub-trees. Balancing is done using rotation techniques. If the balance factor is greater than one, rotation shifts the nodes to the opposite of the left or right sub-trees. The search, addition, and deletion operations are processed in the order of O(log n).

Package non_linear_data_structure Time : 2021/5/11 8:46 下午 Author : xushiyin contact : yuqingxushiyin@gmail.com

Package non_linear_data_structure Time : 2021/5/21 4:43 下午 Author : xushiyin contact : yuqingxushiyin@gmail.com

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InsertNode

func InsertNode(treeNode **AVLTreeNode, key KeyValue)

InsertNode method

func PrintTable

func PrintTable(t Table)

PrintTable print table content

func RemoveNode

func RemoveNode(treeNode **AVLTreeNode, key KeyValue)

RemoveNode method

Types

type AVLTreeNode

type AVLTreeNode struct {
	KeyValue     KeyValue
	BalanceValue int
	LinkedNodes  [2]*AVLTreeNode
}

AVLTreeNode class

func BalanceTree

func BalanceTree(rootNode *AVLTreeNode, nodeValue int) *AVLTreeNode

BalanceTree method changes the balance factor by a single or double rotation

type BinarySearchTree

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

BinarySearchTree class

func (*BinarySearchTree) InOrderTraverseTree

func (tree *BinarySearchTree) InOrderTraverseTree(function func(int))

InOrderTraverseTree method

func (*BinarySearchTree) InsertElement

func (tree *BinarySearchTree) InsertElement(key int, value int)

InsertElement method

func (*BinarySearchTree) MaxNode

func (tree *BinarySearchTree) MaxNode() *int

MaxNode method

func (*BinarySearchTree) MinNode

func (tree *BinarySearchTree) MinNode() *int

MinNode method

func (*BinarySearchTree) PostOrderTraverseTree

func (tree *BinarySearchTree) PostOrderTraverseTree(function func(int))

PostOrderTraverseTree method

func (*BinarySearchTree) PreOrderTraverseTree

func (tree *BinarySearchTree) PreOrderTraverseTree(function func(int))

PreOrderTraverseTree method

func (*BinarySearchTree) RemoveNode

func (tree *BinarySearchTree) RemoveNode(key int)

RemoveNode method

func (*BinarySearchTree) SearchNode

func (tree *BinarySearchTree) SearchNode(key int) bool

SearchNode method

func (*BinarySearchTree) String

func (tree *BinarySearchTree) String()

Stringer method

type Column

type Column struct {
	Id    int
	Value string
}

Column class

type IntegerKey

type IntegerKey int

func (IntegerKey) EqualTo

func (k IntegerKey) EqualTo(k1 KeyValue) bool

func (IntegerKey) LessThan

func (k IntegerKey) LessThan(k1 KeyValue) bool

type KeyValue

type KeyValue interface {
	LessThan(KeyValue) bool
	EqualTo(KeyValue) bool
}

KeyValue type

type Row

type Row struct {
	Columns []Column
	Id      int
}

Row class

type Table

type Table struct {
	Rows        []Row
	Name        string
	ColumnNames []string
}

Table class

type TreeNode

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

TreeNode class

Jump to

Keyboard shortcuts

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