I have a binary search tree created in C. The problem is I can't find a efficient way to delete all the nodes with e.g., id>5.

When I traverse the tree, if I delete a node, the recursion is getting error, because the structure is not the same.

Is there any way, instead of using a helping stack to keep the data before delete them from the tree?