mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 15:11:16 +08:00
Add comments to Trie "add" method.
This commit is contained in:
parent
eac3e81a21
commit
6e2ff9b604
@ -30,6 +30,8 @@ export default class TrieNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const childNode = this.children.get(character);
|
const childNode = this.children.get(character);
|
||||||
|
|
||||||
|
// In cases similar to adding "car" after "carpet" we need to mark "r" character as complete.
|
||||||
childNode.isCompleteWord = childNode.isCompleteWord || isCompleteWord;
|
childNode.isCompleteWord = childNode.isCompleteWord || isCompleteWord;
|
||||||
|
|
||||||
return childNode;
|
return childNode;
|
||||||
|
Loading…
Reference in New Issue
Block a user