containers

package
v0.0.0-...-89b8728 Latest Latest
Warning

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

Go to latest
Published: May 22, 2019 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

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

func NewItem

func NewItem(key int, priority int) *Item

func (Item) Key

func (i Item) Key() int

func (Item) Priority

func (i Item) Priority() int

type PriorityQueue

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

func NewPriorityQueue

func NewPriorityQueue(n int) *PriorityQueue

func (*PriorityQueue) Contains

func (pq *PriorityQueue) Contains(key int) bool

func (*PriorityQueue) GetItem

func (pq *PriorityQueue) GetItem(key int) (Item, error)

func (PriorityQueue) Len

func (pq PriorityQueue) Len() int

func (PriorityQueue) Less

func (pq PriorityQueue) Less(i, j int) bool

func (*PriorityQueue) Pop

func (pq *PriorityQueue) Pop() interface{}

func (*PriorityQueue) Push

func (pq *PriorityQueue) Push(x interface{})

func (PriorityQueue) Swap

func (pq PriorityQueue) Swap(i, j int)

func (*PriorityQueue) Update

func (pq *PriorityQueue) Update(key int, priority int) error

type Trie

type Trie struct {
	Root *TrieNode
}

Trie represents a set of words

func NewTrie

func NewTrie() *Trie

NewTrie initialises a new empty trie

func (*Trie) Insert

func (t *Trie) Insert(word string) error

Insert inserts a word into our Trie NOTE: this only works on ASCII set.

func (*Trie) Search

func (t *Trie) Search(word string) bool

Search finds a word in our Trie (if it exists) To solve this specific problem we only allow a maximum edit distance of 1 In the real world it should probably be more tolerant than that.

type TrieNode

type TrieNode struct {
	Data     byte
	IsEnd    bool
	Children [26]*TrieNode
}

TrieNode represents a subtree in the trie

func NewTrieNode

func NewTrieNode() *TrieNode

NewTrieNode creates a new empty trie node

Jump to

Keyboard shortcuts

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