Assume we have the normal binary search tree over integers.
I am interested in the number of elements that are multiples of 3 and greater than a given number x. Also, I am interested in the number of elements that are multiples of 3 and strictly between two given numbers x1,x2 with x1 < x2. The naive approach would be for example to search the number x and then check each number if it is a multiple of 3. Is there a way to modify the binary search tree, such that these two operations are more efficiently