struct bst * BSTsearch(struct bst ** MAIN_ROOT,key)
{
if ( MAIN_ROOT==NULL )
return NULL;
if(MAIN_ROOT->data==key)
return MAIN_ROOT;
else if ( MAIN_ROOT->data < key )
return BSTsearch ( MAIN_ROOT->left,key);
else
return BSTsearch(MAIN_ROOT->right,key);
}
void sumSearch(struct bst ** MAIN_ROOT , struct bst **
root,sum)
{
if(root!=NULL)
{
SumSearch( MAIN_ROOT ,
root->left,sum);
int key=sum - root->data;
if ( key ! = root -> data &&
BSTsearch ( MAIN_ROOT , key ) ! = NULL )
{
printf("First element : %d \n Second
Element: %d " key , root->data);
return ;
}
SumSearch( MAIN_ROOT ,
root->right, sum);
}
}
hello geeks can it work ?:
if not then tell me which part so that i can modify
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.