Koenrad

Untitled

Jun 1st, 2013
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1.  
  2. void WordTree::Add(const string& n) {
  3.     Add(root, n);
  4. }
  5.  
  6. void WordTree::Add(WordNode*& p, const string& n)  {
  7.     if ( p == NULL) {
  8.         p = new WordNode(n);
  9.     } else if (n < p->word) {
  10.         Add(p->left, n);
  11.     } else {
  12.         Add(p->right, n);
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment