Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

appleJax
Copy link
Contributor

@appleJax appleJax commented Aug 25, 2018

Fix for Trie.addWord (actual code changed is in TrieNode.addChild)

Currently when adding a substring of an existing word, the new word does not get marked as a complete word. Here's an example:

const trie = new Trie();
trie.addWord('javascript');
trie.addWord('java');

trie.doesWordExist('java'); // returns false

This PR fixes the issue.

@codecov-io
Copy link

Codecov Report

Merging #177 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #177   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files         134    134           
  Lines        2486   2488    +2     
  Branches      416    417    +1     
=====================================
+ Hits         2486   2488    +2
Impacted Files Coverage Δ
src/data-structures/trie/TrieNode.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 872a38f...6ae3d7b. Read the comment docs.

@trekhleb trekhleb changed the base branch from master to trie-fix August 25, 2018 10:26
@trekhleb
Copy link
Owner

Thank you for the fix @appleJax

@trekhleb trekhleb merged commit eac3e81 into trekhleb:trie-fix Aug 25, 2018
@appleJax appleJax deleted the fix/trieNodeAddChild branch August 28, 2018 04:44
harshes53 pushed a commit to harshes53/javascript-algorithms that referenced this pull request Dec 6, 2018
shoredata pushed a commit to shoredata/javascript-algorithms that referenced this pull request Mar 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants