Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6e4d7a1

Browse files
committedMar 30, 2018
Add Trie.
1 parent b7675f8 commit 6e4d7a1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed
 

‎src/data-structures/trie/Trie.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default class Trie {
2626
return lastCharacter.suggestChildren();
2727
}
2828

29-
doesWordExists(word) {
29+
doesWordExist(word) {
3030
return !!this.getLastCharacterNode(word);
3131
}
3232

‎src/data-structures/trie/__test__/Trie.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ describe('Trie', () => {
4444
trie.addWord('car');
4545
trie.addWord('caption');
4646

47-
expect(trie.doesWordExists('cat')).toBeTruthy();
48-
expect(trie.doesWordExists('cap')).toBeTruthy();
49-
expect(trie.doesWordExists('call')).toBeFalsy();
47+
expect(trie.doesWordExist('cat')).toBeTruthy();
48+
expect(trie.doesWordExist('cap')).toBeTruthy();
49+
expect(trie.doesWordExist('call')).toBeFalsy();
5050
});
5151
});

0 commit comments

Comments
 (0)
Please sign in to comment.