BST

Can someone show me how to write a statement that would not let the compiler crash when it is imputed a non existence number for deletion;

i have the complete code, i just need a statement that would make sure that the program doesn't crash when a number that is not in BST is imputed for deletion

i tried something like this

1
2
3
4
if (num != root->data)
{
     return;
}

but it doesn't seem to work for Binary Tree even though it worked for Linked list
any help is appreciable

Thanks!!!
Last edited on
try-catch blocks. they catch exceptions and if it fails try to fix it
use boolean, take this code for example:
http://coliru.stacked-crooked.com/a/408db56313a681a9
thanks
Topic archived. No new replies allowed.