Guest User

Untitled

a guest
Jul 17th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. void Trie::insert(string x, Item* pointer){
  2. BasicTrieNode *current;
  3. int j;
  4. current = root;
  5.  
  6. int i = 0;
  7. while(x[i] != '\0'){
  8. j = x[i] - 'a';
  9. cout << j << endl;
  10.  
  11. if(current -> getPtr(j) == 0){
  12. if(x[i+1] == '\0')
  13. current -> setPtr(j, new BasicTrieNode());
  14. else
  15. current -> setPtr(j, new TrieNode());
  16. }
  17.  
  18. current = current -> getPtr(j);
  19. i++;
  20. }
  21.  
  22. current -> setPtr2Item(pointer); // SEG FAULTING HERE
  23. return;
  24. }
Add Comment
Please, Sign In to add comment