в чем разница в
[insert_node (& (tmp-> left), value);] VS [tmp = tmp-> right;insert_node (& (tmp), значение);]
void insert_node(struct btree **bt,int value)
{
btree *tmp= *bt, *r ;
if(*bt==NULL)// first node
{
(*bt)=(struct btree *)malloc(sizeof(btree));
(*bt)->data=value;
(*bt)->left=NULL;
(*bt)->right=NULL;
}
else
{
if(value > tmp->data)
insert_node(&(tmp->right),value);
else
insert_node(&(tmp->left),value);
}
#if 0 //start
OR /** COMMENT START
earlier I had below piece of code but not working
can any please explain what's the difference in
insert_node(&(tmp->left),value); VS [ tmp=tmp->right; insert_node(&(tmp),value);]
COMMENT END **/
else
{
if(value > tmp->data)
tmp=tmp->right;
else
tmp=tmp->left ;
insert_node(&tmp,value);
}
#endif //end
}