MCPcopy Create free account
hub / github.com/trekhleb/javascript-algorithms / suggestNextCharacters

Method suggestNextCharacters

src/data-structures/trie/Trie.js:70–78  ·  view source on GitHub ↗

* @param {string} word * @return {string[]}

(word)

Source from the content-addressed store, hash-verified

68 * @return {string[]}
69 */
70 suggestNextCharacters(word) {
71 const lastCharacter = this.getLastCharacterNode(word);
72
73 if (!lastCharacter) {
74 return null;
75 }
76
77 return lastCharacter.suggestChildren();
78 }
79
80 /**
81 * Check if complete word exists in Trie.

Callers 1

Trie.test.jsFile · 0.80

Calls 2

getLastCharacterNodeMethod · 0.95
suggestChildrenMethod · 0.80

Tested by

no test coverage detected