MCPcopy Create free account
hub / github.com/algorithmzuo/algorithm-journey / search

Method search

src/class044/Code02_TrieTree.java:47–57  ·  view source on GitHub ↗
(String word)

Source from the content-addressed store, hash-verified

45 }
46
47 public static int search(String word) {
48 int cur = 1;
49 for (int i = 0, path; i < word.length(); i++) {
50 path = word.charAt(i) - 'a';
51 if (tree[cur][path] == 0) {
52 return 0;
53 }
54 cur = tree[cur][path];
55 }
56 return end[cur];
57 }
58
59 public static int prefixNumber(String pre) {
60 int cur = 1;

Callers 2

deleteMethod · 0.95
mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected