trie_create: Create a trie

View source: R/trie.R

trie_createR Documentation

Create a trie

Description

Create a trie

Usage

trie_create(words = NULL)

Arguments

words

vector of character strings with which to initialise trie. Default: NULL

Trie data representation

The trie is implemented here as nested environments. Environments are created with new.env(parent = emptyenv(), hash = FALSE).

Using the emptyenv() as parent saves some memory, as the parent environment is never needed in this process.

hash is set to FALSE as using a hash table expands the memory usage by quite a bit - even if size is set on the hash table.

Using a hash table on the environment doesn't appreciably change the speed of trie creation or preforming look-ups.


coolbutuseless/simpletrie documentation built on July 28, 2024, 3:49 p.m.