The Lua algorithms repository already includes several fundamental data structures such as graphs, heaps, segment trees, sorted sets, k-d trees, and union-find. One classic structure that is still missing is a Trie (prefix tree).
Why this should be added
- Trie is a core data structure for prefix-based lookups and dictionary-style operations.
- It complements the existing collection of structures in
src/data_structures.
- It is useful for string matching, autocomplete, prefix searches, and dictionary membership checks.
Proposed implementation
Add a Lua implementation under src/data_structures/ with support for:
- inserting strings or keys
- checking whether a key exists
- searching by prefix
- returning all keys under a prefix (optional but useful)
- basic traversal/iteration operations
Suggested API shape
A minimal API could look like:
Trie.new()
:insert(key)
:contains(key)
:has_prefix(prefix)
:keys_with_prefix(prefix) or similar
This would make the repository more complete and provide a useful, widely applicable structure alongside the current implementations.
The Lua algorithms repository already includes several fundamental data structures such as graphs, heaps, segment trees, sorted sets, k-d trees, and union-find. One classic structure that is still missing is a Trie (prefix tree).
Why this should be added
src/data_structures.Proposed implementation
Add a Lua implementation under
src/data_structures/with support for:Suggested API shape
A minimal API could look like:
Trie.new():insert(key):contains(key):has_prefix(prefix):keys_with_prefix(prefix)or similarThis would make the repository more complete and provide a useful, widely applicable structure alongside the current implementations.