You are asked to implement a binary search tree. You have to implement the following methods.
1. Insert x:
Insert an integer x into the binary search tree if x is not in the tree yet. If x is NOT in the binary search tree, you don’t need to do anything.
2. Delete x:
Delete x if x is in the binary search tree. Please use the smallest element in right subtree to replace x. If x is not in the binary search tree, you don’t need to do anything.
3. Height:
Print the height of the binary search tree.
4. Find x:
Print “Find x: Yes” if x is in the binary search tree; Otherwise, print “Find x: No”.
5. Clear:
Drop all the nodes of the binary search tree.
Note:
There are many lines in the input. Each line contains an operation defined above.
For a “Find” or a “Height” operation, you need to output the result of the operation.