- Preparing search index...
- The search index is not available
structalgo
Properties
Private root
root: TrieNode
Methods
Private collectWords
- collectWords(node, prefix, words): void
-
Parameters
-
node: TrieNode
-
prefix: string
-
words: string[]
Returns void
delete
- delete(word): boolean
-
Returns boolean
Private deleteHelper
- deleteHelper(node, word, index): boolean
-
Parameters
-
node: TrieNode
-
word: string
-
index: number
Returns boolean
Private findNode
- findNode(prefix): null | TrieNode
-
Returns null | TrieNode
getAllWords
- getAllWords(): string[]
-
Returns string[]
insert
- insert(word): void
-
Returns void
search
- search(word): boolean
-
Returns boolean
startsWith
- startsWith(prefix): boolean
-
Returns boolean
wordsWithPrefix
- wordsWithPrefix(prefix): string[]
-
Returns string[]
Helper method to collect all words from a node