Hello
Is there any easy way to implement a set supporting following 2 operations in O(log(n)) ?
1)Insertion
2)Count of elements in the set having value <= x. (x is an Integer)
Values inside set can be from 1 to 1e9.
I am sorry if this in an easy/standard problem.
Try this
You can use Ordered Set
Auto comment: topic has been updated by vijasi (previous revision, new revision, compare).
A set can't do the 2nd operation in O(log(n))
but an ordered set can check Policy-based data structures