A data structure for holding numbers in 2 sets, using BST?
Since it's your exercise, I don't want to prevent you from finding the solution on your own, but I'll give you some possible hints:

Big hint:


   You can do some work during the Insert operation to make any subsequent Find run fast.


Think about that one for a while.



If you're still stuck, here are some more specific hints.  I recommend you think about each one for 15 minutes or more before moving on to the next one.

Hint #2:


   Suppose you wanted to implement an operation InsertAndFind(a,S), that effectively does Insert(a,S) followed by Find().  Could you make that run in O(log n) time?


Hint #3:


   It would also be possible to have a single data structure (e.g., a single augmented balanced binary search tree), with some information in each node.


Hint #4:


   What information would you want to keep in a node, to determine whether that node is something that could be returned in response to a future Find query?