trie_search 0.0.1
trie_search: ^0.0.1 copied to clipboard
A special data structure used to store strings that can be visualized like a graph.
Trie Data Structure in Dart #
This package provides a basic implementation of a Trie data structure in Dart. It offers functionalities like inserting words, searching by prefix, and clearing the Trie, making it an efficient solution for handling prefix-based search operations.
Features #
- Efficient word insertion: Adds words to the Trie with associated details.
- Prefix-based search: Retrieve all words starting with a given prefix.
- Memory efficient: Significantly more memory-efficient than using a List for large datasets.
- Clear method: Easily reset the Trie by deleting all stored data.
Getting Started #
To start using the Trie package, follow these steps:
-
Add the package to your
pubspec.yamlfile:dependencies: trie_data_structure: ^0.0.1 -
'''dart import 'package:trie_data_structure/trie_data_structure.dart';
void main() { // Initialize a Trie with some initial data Trie
// Inserting additional words trie.insert('batman', 'A superhero'); trie.insert('balloon', 'A light inflated object');
// Searching for words with a given prefix print('Words with prefix "app":'); Set
// Clearing the trie trie.clear(); print('Trie cleared.');
// After clearing, trying to search again Set
'''