0
Can somebody help me with error Its a small error ...idk please run in ide's
Binary tree successor and predecessor https://code.sololearn.com/cW70J8mm039z/?ref=app https://code.sololearn.com/cW70J8mm039z/?ref=app
6 Answers
+ 1
At first glance, the function declaration for findPreSuc() does not look right. I think the ampersands (&) on the parameters should not be there.
Change this:
void findPreSuc( struct Node* root, struct Node* &pre, struct Node* &suc, int key)
To this:
void findPreSuc( struct Node* root, struct Node* pre, struct Node* suc, int key)
Remove #import <conio.h>, because you are not using any of the functions defined therein. Then you can also have it build and run here on SoloLearn.
+ 1
Tnx for the help bro
0
K tnx I will try
0
Tnx any way but the output doesnt seem enriching have to try more....
0
Sooraj m, now I looked at it in depth and I see the need for more pointer syntax corrections. Here are the line numbers and corrected code.
14 void findPreSuc( struct Node* root, struct Node** pre, struct Node** suc, int key)
26 *pre = tmp ;
35 *suc = tmp ;
43 *suc = root ;
48 *pre = root ;
97 findPreSuc(root, &pre, &suc, key);
Try these changes. I think you will be very pleased with the outcome!
0
You are welcome!