I got the pseudocode for the following algorithm, with r being the root of a BST and x,y are numbers with x TreeCount(r,x,y) if r=null: return 0
TreeCount(r,x,y) if r=null: return 0