Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
indy256 committed Dec 7, 2014
1 parent b5ced65 commit 9dc854e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions java/src/Trie.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ static class TrieNode {
}

public static void insertString(TrieNode root, String s) {
TrieNode v = root;
TrieNode cur = root;
for (char ch : s.toCharArray()) {
TrieNode next = v.children[ch];
if (next == null)
v.children[ch] = next = new TrieNode();
v = next;
if (cur.children[ch] == null) {
cur.children[ch] = new TrieNode();
}
cur = cur.children[ch];
}
v.leaf = true;
cur.leaf = true;
}

public static void printSorted(TrieNode node, String s) {
Expand Down

0 comments on commit 9dc854e

Please sign in to comment.