text-processing-algorithms/dist/data-structures/index.d.ts
2026-01-21 11:37:28 -08:00

25 lines
659 B
TypeScript

interface TrieNode {
children: Map<string, TrieNode>;
isEndOfWord: boolean;
frequency: number;
}
declare class Trie {
private root;
private size;
constructor();
private createNode;
insert(word: string, frequency?: number): void;
search(word: string): boolean;
private findNode;
startsWith(prefix: string): boolean;
getSuggestions(prefix: string, maxSuggestions?: number): string[];
private collectWordsWithPrefix;
private collectWords;
delete(word: string): boolean;
private deleteHelper;
getAllWords(): string[];
getSize(): number;
clear(): void;
}
export { Trie, type TrieNode };