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! -------------- For a proof: First you should show that this algorithm is complete, i.e. show that it gets you the answer you want. Then all you need to do is argue the asymptotic bounds. These arguments should be based on the fact that this is a BST, e.g. a search in a BST is in the worst case $O(h)$ where $h = O(lg(n))$ is the height of the tree because at each step in the search, you go up one level in the tree.