I did but the first value deletes..new value is added also
1 2 3 4 5 6 7 8 9 10
in Main()
strcpy(item.bar, "5505505");//adds
val.addNode(item);
strcpy(item.bar, "1010101");//adds
val.addNode(item);
//cout<<val.findNode("1010101")<<endl;//outputs 1
val.updateItem("1010101");//I add 99999
cout<<val.findNode("5505505")<<endl;//this value is deleted
cout<<val.findNode("99999")<<endl;//this value is found
The logic was messing up because I was replacing the key node value to separate right node from left...Actually I am not supposed to update key node value but other values which do not separate left and right subtrees based on lesser and greater equality
Struct node{
keyvalue; //this is needed to position nodes in the respective tree..
//other values;//these values could be changed but not keyvalue