The following tasks should be solved in any programming language. Of course, the condition is that the language supports recursion and object oriented programming.
Tasks to accomplish
Task 1 – Binary search tree
Implement the class for a binary search tree. Keys of tree nodes should be simple integer numbers. Your class should provide the following public operations (the prototypes are written in C# but you may transfer them to any language):
- void Add(int key) – adds element to the tree.
- void Print() – prints all elements in the tree in a sorted order.
- Boolean Search(int key) – returns true if the given key is inside the tree and false otherwise.