core

package
v0.0.0-...-adfef49 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package core provides essential abstractions for building a trie tree

Package core provides essential abstractions for building a trie tree

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

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

This struct provides a node structure

@attr char: string @attr children: slice

func NewNode

func NewNode(char string) *Node

This method provides a new node structure

For each children of node is inserted a nil to allocate memory and complete the tree

@param char: string - The character to be inserted into the node

@return node: *Node

type Trie

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

This struct provides a Trie tree structure

func NewTrie

func NewTrie() *Trie

This method provides a new Trie tree struture

For each new Trie tree created the root is initialised with the value "\000" that represents the nil value in UNICODE table

@return &Trie: *Trie

func (*Trie) Insert

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

This method is reponsible for insert a new element into the Trie

@param word: string - word to be inserted into the Trie

@return _, error: nil, _ - if something went wrong nothing happens, otherwise thats OK

func (*Trie) RemoveWord

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

This methods is responsible for delete a word from the Trie

@param word: string - word to be deleted from the Trie

@return bool - if deleted, return true, otherwise return false

func (*Trie) SearchWord

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

This methods is responsible for search a word into the Trie

@param word: string - word to be searched into the Trie

@return bool - if found, return true, otherwise return false

Jump to

Keyboard shortcuts

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