MCPcopy Create free account
hub / github.com/SuprDewd/CompetitiveProgramming / countMatches

Method countMatches

code/strings/trie.cpp:24–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 } begin++, cur = it->second; } } }
23 template<class I>
24 int countMatches(I begin, I end) {
25 node* cur = root;
26 while (true) {
27 if (begin == end) return cur->words;
28 else {
29 T head = *begin;
30 typename map<T, node*>::const_iterator it;
31 it = cur->children.find(head);
32 if (it == cur->children.end()) return 0;
33 begin++, cur = it->second; } } }
34 template<class I>
35 int countPrefixes(I begin, I end) {
36 node* cur = root;

Callers 1

testFunction · 0.80

Calls 1

findMethod · 0.45

Tested by 1

testFunction · 0.64