trie_create: Create a trie

Description Usage Arguments Trie data representation

View source: R/trie.R

Description

Create a trie

Usage

1
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 Aug. 2, 2020, 12:49 a.m.