I am trying to figure out a bunch of practice problems involving Binary Search Trees and recursion. A lot of them are like "Copy an entire BST except..." and then some stipulation, like except the largest (all the way to the right), except the smallest (all the way to the left), except the two largest, etc.
The last stipulation is to do the requested action in a single recursive call. The practice program uses a randomly generated BST of random integer data (and random size).
I am trying to get started practicing on what I feel is one of the easier ones, copy all but max. I imagine the solution is some combination of two of my algorithms (one is to remove the max node, the other is just a copy).
Here is what I have so far, if anyone can help me with advice on how to tackle this:
COPY
Thank you for the assistance. I ended up going with a less efficient solution.
A lot of the suggestions were beyond the scope of what we were allowed to change (like the constructor), and were not allowed to use ternary operators because were told they make things unreadable, and cause errors if precedence is not managed properly.