Number of elements less than VAL in an array

Правка en2, от 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.

Теги #data structure

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский LittleMaster_7 2016-08-10 21:28:34 2 Tiny change: ' 1 , 2 ]\nVAL = ' -> ' 1 , 2 ]\n\nVAL = '
en1 Английский LittleMaster_7 2016-08-10 21:17:11 405 Initial revision (published)