Range Queries

I want to solve range queries in O(logn) time.However, the operation must be performed only on those elements in the range which occur exactly once.
Could someone provide a way?

Learn Segment tree or Fenwick tree data structures for range query problems

it depends what is needed
in general Segment tree is more strong and have wide application area
where as fenwick tree is fast and problem spacific.
if you get Segment tree than easy to get fenwick tree

fenwick tree is five minutes topic only but tricky

The range query isnt the issue. The problem is with the frequency. I have to consider only the elements occurring once.

A structure similar to merge sort tree might help ( Segment tree with a vector in each node).
For leaf nodes the vector simply holds a single value, for interior nodes combine the two children of the node, if any value occurs more than once do not add it to current nodes vector.

It will also be helpful to store the answer for a particular range along with the vector inside node of the tree.