Binary Search try

I cannot get my insert function to work for my binary search tree. Says i need to return a value i dont know what to return

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
template <class DataType>
void BinarySearchTree<DataType>::Insert(const DataType & item)//BSTNode<DataType>*
{
   BSTNodePtr Current, Parent, NewNodePtr;

   Current = Root;
   Parent = NULL;
   while (Current != NULL)
      {
      Parent = Current;
      if (Item < Current->Info)
         Current = Current->Left;
      else
         Current = Current->Right;
      }

   NewNodePtr = GetNode(Item, NULL, NULL);
   if (Parent == NULL)
      Root = NewNodePtr;
   else if (Item < Parent->Info)
      Parent->Left = NewNodePtr;
   else
      Parent->Right = NewNodePtr;

   Count++;
   }
   
}
	
template <class DataType>
BSTNode<DataType>* BSTClass::GetNode(const DataType & item, BSTNode left, BSTNode right)
   {
   BSTNode<DataType>* NodePtr;

   NodePtr = new BSTNodeClass(Item, LeftPtr, RightPtr);
   if (NodePtr == NULL)
      {
      cerr << "Memory allocation error!" << endl;
      exit(1);
      }
   return NodePtr;
   }
Topic archived. No new replies allowed.