How to find frequency of a given element in a range?

Revision en3, by arshad2117, 2017-06-08 19:51:39

Given an array A of n elements and queries of type (l r k),find the number of occurrences of k in the range l to r

If there are no updates, we can solve the problem by having a map<int,vector> and doing a binary search.

But what if there are updates involved.

I read somewhere that we can use bit..

But I am not sure how that would be useful

Thank you in advance

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English arshad2117 2017-06-08 19:51:39 10 Tiny change: ',find the occurrenc' -> ',find the number of occurrenc'
en2 English arshad2117 2017-06-08 19:43:34 1 Tiny change: 'ou in advace' -> 'ou in advance'
en1 English arshad2117 2017-06-08 19:38:44 419 Initial revision (published)