Skip to content

Commit

Permalink
Fix a bug when ET locus node is NULL.
Browse files Browse the repository at this point in the history
  • Loading branch information
xupefei committed Nov 29, 2016
1 parent f7673f7 commit d2b2c18
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/TopK_ET.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public static String[] GetTopK(String prefix, TrieNode root, int k) {
TrieNode[] locuses = root.FindMuchByString(prefix);

if (locuses == null || locuses.length == 0)
root.children.values().forEach(c -> queue.add(new Triplet<>(c, 0, 1)));
return new String[0];
//root.children.values().forEach(c -> queue.add(new Triplet<>(c, 0, 1)));
else {
// we only push the 1st element
TrieNode locus = locuses[locuses.length - 1];
Expand Down

0 comments on commit d2b2c18

Please # to comment.