Problem : Ordered Map
Task : Implement an Ordered Map which supports the given operations
Operations:
1. insert(key, value) – Insert the key value pair. If the key is already present, update it’s current value. [O(log n)]
2. erase(key) – Erase the given key from the map if it is present.[O(log n)]
3. find(key) – returns true if key was found else return 0. [O(logn)]
4. map_obj[key] (subscript operator) – Access the element with the given key(if it is present in the map). Also, you should be able to modify the value at this key using this operator. If the value is not present, then insert this key with it’s corresponding assigned value. [O(log n)]
5. size() – returns the number of keys present in the Map. [O(1)]
6. clear() – removes all the elements from the Map. [O(n)]
Note: : Duplicates are not allowed. No inbuilt functions used.