Number of elements having value <=x in a Set [Solved]

Revision en2, by vijasi, 2020-04-17 20:59:25

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.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English vijasi 2020-04-17 20:59:25 9
en1 English vijasi 2020-04-17 20:52:31 332 Initial revision (published)