tst

package
v1.0.21 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NilKey = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	// The Key stored with this element.
	Key byte
	// The value stored with this element.
	Value interface{}
	// contains filtered or unexported fields
}

func (*Element) Contains

func (e *Element) Contains(prefix []byte) bool

func (*Element) Get

func (e *Element) Get(prefix []byte) (value interface{}, ok bool)

func (*Element) Insert

func (e *Element) Insert(prefix []byte, value interface{})

func (*Element) Left

func (e *Element) Left() *Element

Left returns the left list element or nil.

func (*Element) Middle

func (e *Element) Middle() *Element

Middle returns the middle list element or nil.

func (*Element) Remove

func (e *Element) Remove(prefix []byte) (value interface{}, ok bool)

func (*Element) Right

func (e *Element) Right() *Element

Right returns the middle list element or nil.

func (*Element) String

func (e *Element) String() string

func (*Element) TraversalInOrderFunc

func (e *Element) TraversalInOrderFunc(f func(prefix []byte, value interface{}) (goon bool)) (goon bool)

中序遍历

func (*Element) TraversalPostOrderFunc

func (e *Element) TraversalPostOrderFunc(f func(prefix []byte, value interface{}) (goon bool)) (goon bool)

后序遍历

func (*Element) TraversalPreOrderFunc

func (e *Element) TraversalPreOrderFunc(f func(prefix []byte, value interface{}) (goon bool)) (goon bool)

前序遍历

type TernarySearchTree

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

TernarySearchTree represents a Ternary Search Tree. The zero value for List is an empty list ready to use.

func New

func New() *TernarySearchTree

Init initializes or clears Tree l.

func (*TernarySearchTree) Contains

func (l *TernarySearchTree) Contains(prefix string) bool

func (*TernarySearchTree) Get

func (l *TernarySearchTree) Get(prefix string) (value interface{}, ok bool)

func (*TernarySearchTree) Init

Init initializes or clears tree l.

func (*TernarySearchTree) Insert

func (l *TernarySearchTree) Insert(prefix string, value interface{})

func (*TernarySearchTree) Left

func (l *TernarySearchTree) Left() *Element

Front returns the first element of list l or nil if the list is empty.

func (*TernarySearchTree) Len

func (l *TernarySearchTree) Len() int

Len returns the number of elements of list l. The complexity is O(1).

func (*TernarySearchTree) Middle

func (l *TernarySearchTree) Middle() *Element

Middle returns the first element of list l or nil if the list is empty.

func (*TernarySearchTree) Remove

func (l *TernarySearchTree) Remove(prefix string) (value interface{}, ok bool)

func (*TernarySearchTree) Right

func (l *TernarySearchTree) Right() *Element

Right returns the first element of list l or nil if the list is empty.

func (*TernarySearchTree) String

func (l *TernarySearchTree) String() string

func (*TernarySearchTree) TraversalInOrderFunc

func (l *TernarySearchTree) TraversalInOrderFunc(f func(prefix string, value interface{}) (goon bool)) (goon bool)

func (*TernarySearchTree) TraversalPostOrderFunc

func (l *TernarySearchTree) TraversalPostOrderFunc(f func(prefix string, value interface{}) (goon bool)) (goon bool)

func (*TernarySearchTree) TraversalPreOrderFunc

func (l *TernarySearchTree) TraversalPreOrderFunc(f func(prefix string, value interface{}) (goon bool)) (goon bool)

Jump to

Keyboard shortcuts

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