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

Method insert

CPP/Tries/implementTrie.cpp:33–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31 }
32
33 void insert(string word) {
34 Node* curr = root;
35
36 for(auto &ch:word){
37 if(curr -> child[ch - 97] == NULL)
38 curr -> child[ch - 97] = new Node(ch);
39 curr = curr -> child[ch - 97];
40 }
41
42 curr -> isWord = true;
43 }
44
45 bool search(string word) {
46 Node* reqNode = getNode(word);

Callers 15

mainFunction · 0.45
mainFunction · 0.45
addTextMethod · 0.45
findSubarraysMethod · 0.45
kWeakestRowsMethod · 0.45
addTextMethod · 0.45
permuteUniqueMethod · 0.45
dfsFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected