Question : Code Freezes With No Error

I have an application that is exhibiting behavior I have never encountered before.

The application's purpose is to eliminate the need for managers to do a massive amount of cutting and pasting of Excel data to create sales goals for sellers. My application pulls the raw data into a table and then hits the data with a bunch of queries that extract it back out into Excel with the desired organization. It runs fine on my PC, but with the end users on other PCs it will periodically freeze and simply display the code without generating an error. This also apparently corrupts the Data.mdb, which has to be compacted and repaired before I can get the data to run. I think this may be a chicken/egg problem, because when I try to run the export function on my PC, I get the same behavior as the other users but then after the compact and repair step it runs fine again.

My guess is that the other users may not have sufficient memory, or something else on their PCs is corrupting the data both for them and for me when I try to run it. Is there a way to diagnose this problem? Lacking any error message, I don't really know what to tackle.

Answer : Code Freezes With No Error

Your code would work properly if the tree would remain balanced after deletion. The main cause of your problem is explained below:
Here is the left subtree after you remove the node with value 10.

                                            14
                                           /    \
                                         3      12
                                        /  \        \
                                      1     4       13

If we want to find the node with value 12, according to your code the 12 is compared with 14. If the 12 < 14, the search is done in the left subtree, otherwise in the right one. Obviously, the search return false because the node 12 (as well as the node 13) is located in the right subtree.
To solve the problem you should keep the tree balanced.
Random Solutions  
 
programming4us programming4us