MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / solve

Function solve

CPP/Tries/autoComplete.cpp:77–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75
76
77void solve(){
78 int N, M;
79 cin >> N;
80 cin >> M;
81 vector <pair<string,int>> words(N);
82
83 for (int i=0; i<N; i++){
84 cin >> words[i].first;
85 }
86
87 for (int i=0; i<N; i++){
88 cin >> words[i].second;
89 }
90
91 sort(words.begin(), words.end(), comp);
92
93 /* for (int i=0; i<N; i++){
94 cout << words[i].first << " " << words[i].second << " " << endl;
95 }
96 */
97
98 TrieNode *root=new TrieNode();
99
100 for (int i=0; i<N; i++){
101 insertTrie(root,words[i].first,i);
102 }
103
104 for (int i=0; i<M; i++){
105 string prefix;
106 cin >> prefix;
107
108 searchAndPrint(words, root,prefix);
109 }
110}
111
112int main() {
113 // YOUR CODE GOES HERE

Callers 9

mainFunction · 0.70
cursorLeftMethod · 0.50
cursorRightMethod · 0.50
cursorLeftMethod · 0.50
cursorRightMethod · 0.50
solveMethod · 0.50
numRollsToTargetMethod · 0.50
solveMethod · 0.50
numRollsToTargetMethod · 0.50

Calls 2

insertTrieFunction · 0.85
searchAndPrintFunction · 0.85

Tested by

no test coverage detected