Problems
Binary Search Tree 1
Binary Search Tree 1
Implement a balanced binary search tree.
Input
Contains the description of operations on the tree, their number is not greater than 105
. Each line contains one of the following operations:
- insert x - add the key x into the tree. If the key x is already in the tree, do nothing.
- delete x - delete the key x from the tree. If the tree does not contain the key x, do nothing.
- exists x - if the key x is in the tree, print "true", otherwise print "false".
All numbers are integers not greater than 109
by absolute value.
Output
Print the result of all operations exists in format given in the sample output.
Input example #1
insert 2 insert 5 insert 3 exists 2 exists 4 delete 5
Output example #1
true false