It sounds like your pseudocode is equivalent to the following: - Do search for *low* in the BST. Find this value or the next largest value. (assuming that the BST is somewhat balanced, this is $O(lg(n))$) - In-order traverse until we reach an element that is greater than *high*, adding all values that we traverse to some running sum. (in order traversal of $m$ elements in a BST is time $O(m)$ since each element is visited at most twice.) - The running sum gives us our answer. The total runtime of this is $O(lg(n) + m)$ This is equivalent to what you write in your psuedocode I believe. The ignoring of subtrees that are not in the range of interest is what is done in a search. Hope this helps!