title: Count number of nodes within range inside Binary Search Tree in O(LogN)
body: <p>Given a BST and two integers 'a' and 'b' (a &lt; b), how can we find the number of nodes such that , a &lt; node value &lt; b, in O(log n)?</p>
  
  <p>I know one can easily find the position of a and b in LogN time, but how to count the nodes in between without doing a traversal, which is O(n)?</p>