Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Trie::insert(string x, Item* pointer){
- BasicTrieNode *current;
- int j;
- current = root;
- int i = 0;
- while(x[i] != '\0'){
- j = x[i] - 'a';
- cout << j << endl;
- if(current -> getPtr(j) == 0){
- if(x[i+1] == '\0')
- current -> setPtr(j, new BasicTrieNode());
- else
- current -> setPtr(j, new TrieNode());
- }
- current = current -> getPtr(j);
- i++;
- }
- current -> setPtr2Item(pointer); // SEG FAULTING HERE
- return;
- }
Add Comment
Please, Sign In to add comment