st

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TraversePreOrder represents pre-order traversal order
	TraversePreOrder = 0
	// TraverseInOrder represents in-order traversal order
	TraverseInOrder = 1
	// TraversePostOrder represents post-order traversal order
	TraversePostOrder = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type KeyValue

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

KeyValue represents a key-value pair

type OrderedSymbolTable

type OrderedSymbolTable interface {
	SymbolTable
	Min() (Generic, Generic)
	Max() (Generic, Generic)
	Floor(Generic) (Generic, Generic)
	Ceiling(Generic) (Generic, Generic)
	Rank(Generic) int
	Select(int) (Generic, Generic)
	DeleteMin() (Generic, Generic)
	DeleteMax() (Generic, Generic)
	RangeSize(Generic, Generic) int
	Range(Generic, Generic) []KeyValue
	Traverse(int, VisitFunc)
	Graphviz() string
}

OrderedSymbolTable represents an ordered symbol table (key-value collection)

func NewAVL

func NewAVL(compareKey Compare) OrderedSymbolTable

NewAVL creates a new AVL Tree

func NewBST

func NewBST(compareKey Compare) OrderedSymbolTable

NewBST creates a new Binary Search Tree

func NewRedBlack

func NewRedBlack(compareKey Compare) OrderedSymbolTable

NewRedBlack creates a new Red-Black Tree

type SymbolTable

type SymbolTable interface {
	Size() int
	Height() int
	IsEmpty() bool
	Put(Generic, Generic)
	Get(Generic) (Generic, bool)
	Delete(Generic) (Generic, bool)
	KeyValues() []KeyValue
	// contains filtered or unexported methods
}

SymbolTable represents an unordered symbol table (key-value collection)

type VisitFunc

type VisitFunc func(Generic, Generic) bool

VisitFunc represents the function for visting a key-value

Jump to

Keyboard shortcuts

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