Number of elements less than VAL in an array

Revision en2, by LittleMaster_7, 2016-08-10 21:28:34

Suppose, there is an array of size N. Find number of elements are less than VAL. The array may contain duplicate values.

for example,

array = [ 1 , 2 , 3 , 1 , 2 ]

VAL = 3

So answer will be = 4.

Can it done by STL. (such as set/multiset ) in logarithmic time

I already googled it ,but failed to find solution with STL.

Thanks in advance.

Tags #data structure

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English LittleMaster_7 2016-08-10 21:28:34 2 Tiny change: ' 1 , 2 ]\nVAL = ' -> ' 1 , 2 ]\n\nVAL = '
en1 English LittleMaster_7 2016-08-10 21:17:11 405 Initial revision (published)