Needed help in multiset

Revision en2, by hars123, 2019-01-27 17:06:12

I am trying to find number of elements smaller than or equal to a particular value inside the multiset. I want a logn time approach. I have tried using distance(s.begin(),s.upper_bound(val)). But using distance method could take O(N) time in worst case.Can someone help me.

Tags #multiset

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English hars123 2019-01-27 17:06:12 0 (published)
en1 English hars123 2019-01-27 17:05:53 303 Initial revision (saved to drafts)