title: Fastest way to find number of elements in a range
body: <p>Given an array with <code>n elements</code>, how to find the number of elements <code>greater</code> than or <code>equal</code> to a given <code>value (x)</code> in the given range <code>index i to index j</code> in <code>O(log n)</code> or <code>better</code> complexity?</p>
  
  <p>my implementation is this but it is <code>O(n)</code></p>
  
  <pre><code>for(a=i;a&lt;=j;a++)
      if(p[a]&gt;=x) // p[] is array containing n elements
      count++;
  </code></pre>