Implements the Trie (Prefix Tree) data structure. More...
#include <trie.hpp>
Public Member Functions | |
| Trie () | |
| void | insert (const std::string &word, int index) | 
| Inserts a word into the Trie.   | |
| auto | search (const std::string &prefix) -> std::vector< int > | 
| Searches for words starting with a given prefix.   | |
| void | deleteWord (const std::string &word, int index) | 
| Deletes a word from the Trie.   | |
| void | clear () | 
| Clears all nodes in the Trie.   | |
| auto | is_empty () const -> bool | 
| Checks if the Trie is empty.   | |
Implements the Trie (Prefix Tree) data structure.
This class provides methods to insert artist names into the Trie and search for all names that start with a given prefix. It stores a list of indices for each node, making it efficient to retrieve all matching names for a prefix.
      
  | 
  inline | 
      
  | 
  inline | 
Clears all nodes in the Trie.
      
  | 
  inline | 
Deletes a word from the Trie.
| word | The word to delete. | 
| index | The index associated with the word. | 
      
  | 
  inline | 
Inserts a word into the Trie.
| word | The word to insert. | 
| index | The index associated with the word. | 
      
  | 
  inlinenodiscard | 
      
  | 
  inline | 
Searches for words starting with a given prefix.
| prefix | The search prefix. |