mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-26 15:11:16 +08:00
Use HashTable in TrieNode.
This commit is contained in:
parent
5b3de38cca
commit
e6de25ecb3
@ -1,8 +1,10 @@
|
||||
import HashTable from '../hash-table/HashTable';
|
||||
|
||||
export default class TrieNode {
|
||||
constructor(character, isCompleteWord = false) {
|
||||
this.character = character;
|
||||
this.isCompleteWord = isCompleteWord;
|
||||
this.children = new Map();
|
||||
this.children = new HashTable();
|
||||
}
|
||||
|
||||
getChild(character) {
|
||||
@ -22,7 +24,7 @@ export default class TrieNode {
|
||||
}
|
||||
|
||||
suggestChildren() {
|
||||
return [...this.children.keys()];
|
||||
return [...this.children.getKeys()];
|
||||
}
|
||||
|
||||
toString() {
|
||||
|
Loading…
Reference in New Issue
Block a user